If I have a MySQL-table consisting of the fields one, two, three and four can I then somehow use the IF statement to receive the field four, only when a certain condition is true? Do I have to have two sets of SELECT statement?
Can I do (in pseudocode):
SELECT one, two, three
IF (1 == 1) THEN
four
ENDIF
FROM table
Or do I somehow have to do:
IF (1 == 1) THEN
SELECT one, two, three, four
ENDIF
ELSE THEN
SELECT one, two, three
ENDIF
I'm just curious, I don't have a specific usage for this.