Francisco Tapia
fhtapia at gmail.com
Mon Feb 23 13:08:42 CST 2009
Within the view... you'll need to write it as: CREATE VIEW FROM transactions SELECT id, quantity * cost AS [Total Cost] WHERE quantity * cost > 100 -Francisco http://sqlthis.blogspot.com | Tsql and More... On Mon, Feb 23, 2009 at 10:07 AM, Susan Harkins <ssharkins at gmail.com> wrote: > I thought views supported column alias for a derived column, but I'm > getting > an error when I refer to the aliased column in a WHERE clause -- am I > mistaken about this? > > CREATE VIEW > FROM transactions > SELECT id, quantity * cost AS [Total Cost] > WHERE [Total Cost] > 100 > > Plain SQL returns an error -- I know that -- but I expected the View to > handle the column alias in the WHERE clause. Not finding anything helpful > so > far. I can't even say why I thought the View would handle this other than I > guess I've read it somewhere and it stuck. I can't find any views where > I've > actually applied this. > > Susan H. > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > >