I have following fields in my ad_table table:
+----------------------------------------------------------+
|ADVT_ID | RELATIVE_ID | AD_TYPE | AD_LOCATION | AD_IMAGE |
+----------------------------------------------------------+
|1 | 2 | FP | H | test1.jpg |
|2 | 0 | FP | H | test2.jpg |
|3 | 0 | TB | H | test3.jpg |
+----------------------------------------------------------+
I want to use two if statements in mysql query. I want to retrieve data from table using mysql query in this format:
FIRST IF STATEMENT :
if (AD_TYPE = 'FP' && AD_LOCATION = 'H')
then select all data from
table where RELATIVE_ID !=0
SECOND IF STATEMENT :
if(AD_TYPE != 'FP' && AD_LOCATION != 'H')
then select all data from
table where RELATIVE_ID =0
So how to do that in mysql query?
IFflow control statement or theIF()function? The first one is only available in procedures and functions and you don't mention you're writing one. The function, of course, is not a flow control structure. Also, what does the PHP tag have to do with your question?