I have the following fields in my ad_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 a mysql query. I want to get data from a table using mysql query in this format:
FIRST IF STATEMENT:
if (AD_TYPE = 'FP' && AD_LOCATION = 'H')
then select all the data from
where RELATIVE_ID! = 0
SECOND IF STATEMENT:
if (AD_TYPE! = 'FP' && AD_LOCATION! = 'H')
then select all the data from the
table where RELATIVE_ID = 0
So how to do this in mysql query?
source
share