I don't know what kind of title i need to use for this question anyone can help me to choose a title.
Anyway My question is
I need to run this query.
SELECT key_features,about_course FROM `page_sections` WHERE page_id=15 AND country_id=241 AND state_id=291 AND city_id=1277;
If no record found. Then i need to run same query with city_id=0
SELECT key_features,about_course FROM `page_sections` WHERE page_id=15 AND country_id=241 AND state_id=291 AND city_id=0;
If no record found. Then i need to run same query with state_id=0 && city_id=0
SELECT key_features,about_course FROM `page_sections` WHERE page_id=15 AND country_id=241 AND state_id=0 AND city_id=0;
If no record found. Then i need to run same query with country_id=0 and state_id=0 && city_id=0
SELECT key_features,about_course FROM `page_sections` WHERE page_id=15 AND country_id=0 AND state_id=0 AND city_id=0;
Now there is any better way to run all this query from top to down and get only one row.
I don't want to use neatened if else...
- If first query work no need to run second
- else if Second query work no need to run third
- else if third query work no need to run fouth