I have three tables named:
at_category:
- cat_id
- name
at_category_taxonomy:
- cat_taxonomy_id
- cat_id
- taxonomy
at_shop:
- shop_id
- shop_category
I want to join those three tables by counting result.
For example the category named as Electronic Shops in at_category
table and the value will be stored in at_category_taxonomy
table and the this category id's are having two shops in at_shop
table. same as for remaining categories aaa, bbb, ccc etc...it may be having one or two shops else zero shops.
Example :
1. at_category
______________
cat_id name
1 Electronic Shops
2 Ice Cream Shops
_______________
2. at_category_taxonomy
_______________________________________________
cat_taxonomy_id cat_id taxonomy
3 1 Electronic Shops
4 2 Ice Cream Shops
_______________________________________________
3. at_shop
________________________________
shop_id shop_name shop_category
1 A 1 (ie.Electronic Shops)
2 B 1 (ie.Electronic Shops)
3 C 1 (ie.Electronic Shops)
4 D 2 (ie.Ice Cream Shops)
________________________________
Now : The category Electronic Shops having 3 shops and Ice cream shops having 1 shop
Expecting output :
No.Of.Shops (ASC) (Desc) Category Name (ASC) (Desc)
3 Electronic Shops
1 Ice cream Shops
When i click asc order in no.of shops column then the output will be
No.Of.Shops (ASC) (Desc) Category Name (ASC) (Desc)
1 Ice cream Shops
3 Electronic Shops
This is vise verse for category name too.
now I want to display the result by count the number shops by desc order using codeigniter.