SELECT *, CASE WHEN `sub_cat` IS NULL AND `cat` = "community⊂type=day care" AND `locality` = "fort lauderdale" AND `logo_file_name` IS NOT NULL THEN 10 WHEN `sub_cat` IS NULL AND `cat` = "community⊂type=day care" AND `locality` = "fort lauderdale" AND `logo_file_name` IS NULL THEN 9 WHEN `sub_cat` IS NULL AND `cat` = "community⊂type=day care" AND `locality` IS NULL AND `logo_file_name` IS NOT NULL THEN 8 WHEN `sub_cat` IS NULL AND `cat` = "community⊂type=day care" AND `locality` IS NULL AND `logo_file_name` IS NULL THEN 7 WHEN `sub_cat` IS NOT NULL AND `cat` = "community⊂type=day care" AND `locality` = "fort lauderdale" AND `logo_file_name` IS NOT NULL THEN 6 WHEN `sub_cat` IS NOT NULL AND `cat` = "community⊂type=day care" AND `locality` = "fort lauderdale" AND `logo_file_name` IS NULL THEN 5 WHEN `sub_cat` IS NOT NULL AND `cat` = "community⊂type=day care" AND `locality` IS NULL AND `logo_file_name` IS NOT NULL THEN 4 WHEN `sub_cat` IS NOT NULL AND `cat` = "community⊂type=day care" AND `locality` IS NULL AND `logo_file_name` IS NULL THEN 3 WHEN `sub_cat` IS NULL AND `cat` IS NULL AND `locality` IS NULL AND `logo_file_name` IS NULL THEN 0 END as `rank` FROM `wp_4_slides` WHERE (locality IN ("fort lauderdale") OR locality IS NULL) AND (cat = "community⊂type=day care" OR cat IS NULL) AND active = 1 ORDER BY `rank` DESC LIMIT 20 [9] matching rows / [0.00 msec] Blog ID 4 Blah
COMMUNITY⊂TYPE=DAY CARE