Re: [PHP] SQL ternary thing

2005-04-06 Thread Mattias Thorslund
Rory Browne wrote: Hi I appreciate this is an SQL issue, more than a PHP issue, but since it isn't a DB specific issue, and I'm planning on using it with PHP(and I'm not subscribed to any SQL lists), I thought I'd post it here. I have a table a bit like the following: create table thing (name char(

Re: [PHP] SQL ternary thing

2005-04-06 Thread Philip Hallstrom
CASE should do it... http://www.postgresql.org/docs/7.4/interactive/functions-conditional.html Say's it's SQL compliant so it should be fine for other db's as well... something like: SELECT name, CASE WHEN value=1 THEN name_if_true ELSE name_if_false END FROM thing; Migh

[PHP] SQL ternary thing

2005-04-06 Thread Rory Browne
Hi I appreciate this is an SQL issue, more than a PHP issue, but since it isn't a DB specific issue, and I'm planning on using it with PHP(and I'm not subscribed to any SQL lists), I thought I'd post it here. I have a table a bit like the following: create table thing (name char(10), value boole