Thanks, I'm looking for a SQL query that returns a variable number of
columns.  Many of my columns contain NULL data, and I want to avoid showing
the column altogether in that case.



Simon Slavin-3 wrote:
> 
> 
> On 29 Dec 2009, at 6:29pm, nomorecaddy wrote:
> 
>> Is it possible to run an SQL query in sqlite that displays columns only
>> on a
>> condition?  For example:
>> select col1, (case when 1==2 then col2) from myTable
>> 
>> In this case, I only want to show one column (col1)
> 
> I'm not sure I understand your question, but I'll guess.  A SELECT command
> must return the same number of columns in each row.  You can use a
> conditional function to change what appears in each row and your CASE is
> fine, but you need to correct the syntax:
> 
> http://sqlite.awardspace.us/syntax/sqlitepg09.htm
> 
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/selective-result-columns-tp26958131p26959565.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to