I want to run a single query on my MYSQL database. The table I am searching has a file_type field that will be one of three values (1,2,3). Depending what these values are I want to look for different information from the database.
So for example if the 'file_type' field is 1 or 2 then I want to SELECT fields a,b,c,d However if I notice that file_type = 3 then I want to SELECT fields a,b,c,d,e,f
Can this be done in a single SELECT statement? like this - ish
my_simple_query = SELECT file_type,a,b,c,d FROM table1
my_new_query = SELECT file_type,a,b,c,d (AND e,f IF file_type = 3) FROM table1
thanks all
---------------------------------- ADDITION -----------------------------------
And how would I do this if e,f were stored in another table?
my_multitable_query = SELECT file_type,id,a,b,c,d (AND e,f FROM table2 WHERE id=id) FROM table1
get my drift?