@DCoder said:And the bit that actually made me exclaim "WTF" out loud:
SELECT fields,
more_fields,
'' as nothing,
pr_status as zenon,
0 as fuhrer
FROM table
WHERE cond
UNION
SELECT fields,
more_fields,
'' as nothing,
pr_status as zenon,
1 as fuhrer
FROM table
WHERE reversed_cond I have something that isn't quite this, but still looks kind of WTFy:SELECT field,blah,something_else,'0' as field1, '9' as field6, 'STUPID CONSTANT TEXT' as field11, 'WTF' as field14FROM wtf_tableNotice the constants. This was because my boss wanted to simplify use of constants, so that instead of managing constants in the app, we have to put all those constants in the query. It sounds stupid to me, as all those constants are travelling to the DBMS, and then returning with the results, adding up to the actual data transfer between the DB and the application server. Oh, and multiplied by the rowcount that select generates. But hey, it's "simple"!