> -----Ursprungligt meddelande----- > Från: sqlite-users-boun...@sqlite.org > [mailto:sqlite-users-boun...@sqlite.org] För nomorecaddy > Skickat: den 31 december 2009 17:44 > Till: sqlite-users@sqlite.org > Ämne: Re: [sqlite] selective result columns > > > I'm operating at the user level in a java application. The > application allows me to run an SQL query, then it renders > the output into HTML. I want to avoid showing empty colums > in the HTML output, so I wanted the include/exclude column > logic in my actual SQL statement. > It might not be possible for you but still. Create the "actual SQL" with something like below, assuming that f1 never is NULL select distinct 'select f1'|| case when f2 is null then '' else ',f2' end|| case when f3 is null then '' else ',f3'|| ' from t1;' end from t1; And then use the result to query.
If there are some records where f2 and/or f3 is NULL and others where one or both isn't you will get 2 or maybe even 3 lines from the above SQL. /Roger _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users