Prev: How do I search an entire table for a given values? - Please help with the sql
Next: Query Help.
From: laredotornado on 5 Aug 2010 13:30 Hi, I'm using SQL Server 2005. What I want is to return a column "venue", but if that column is null, I want to return the value of the column "site" (in either case, I want the column header to be "venue"). How do I construct such a query? Thanks, - Dave
From: Plamen Ratchev on 5 Aug 2010 14:15 You can use expression with COALESCE and alias the expression as venue: SELECT COALESCE(venue, site) AS venue... -- Plamen Ratchev http://www.SQLStudio.com
From: Gert-Jan Strik on 5 Aug 2010 14:16 Try this: SELECT COALSECE(venue, site) AS venue FROM my_table -- Gert-Jan laredotornado wrote: > > Hi, > > I'm using SQL Server 2005. What I want is to return a column "venue", > but if that column is null, I want to return the value of the column > "site" (in either case, I want the column header to be "venue"). How > do I construct such a query? > > Thanks, - Dave
|
Pages: 1 Prev: How do I search an entire table for a given values? - Please help with the sql Next: Query Help. |