Php Mysql multisearch functionality -
the issues finding particular businesses based on multi categories. following mysql tables:
business_tbl:
id | business_name | cat_id | cat2_id | cat3_id | sub_cat_id | sub_cat2_id | sub_cat3_id 1 bz1 1 2 3 1001 2001 3001 2 bz2 1 2 3 1002 2002 3002 3 bz3 1 2 3 1003 2003 3003
business_categories_tbl:
id | cat_name 1 food 2 restaurants 3 wine
business_sub_categories_tbl:
b_sub_cat_id | b_sub_cat_name | b_maincat_id 1001 donuts 1 1002 xx 1 2001 steakhouse 2 2001 yy 2 3001 white 3 3002 zz 3
how can find particular business name based on multi category search? example how mysql query need can search through category ie cat_id, cat2_id , cat3_id, sub_cat_id ,sub_cat2_id , sub_cat3_id
, return business_name if match found. current query perform 1 cat_id , 1 sub_cat_id search since joining multi categories not returning anything.thanks
what understand post try build below query. try it:
select business_name business_tbl '1002' in (cat_id, cat2_id , cat3_id, sub_cat_id ,sub_cat2_id, sub_cat3_id)
Comments
Post a Comment