I have a master table its name is "user" table it contain all information of user and there are two tables "business_list" and "classified_list".
I want to show all user information with total number of business from business_list
table and total no of classifieds from classified_list
table
user table
user_id user_name user_email user_phone
-----------------------------------------------------
001 Jose jose@yahoo.in 457855654
002 Tom tom@yahoo.in 5464644654
003 Nick nick@yahoo.in 4545645644
004 Rose rose@yahoo.in 554545441
business_list table
bid user_id business_name
-----------------------------------------------
001 001 Construction business
002 003 Event business
003 001 Crane business
004 003 Furtinure business
005 004 Realestate business
classified_list table:
cid user_id classified_name
-------------------------------------------
001 001 Roller classified
002 004 Home classified
003 003 Chair classified
004 004 Office Classified
005 002 Light decoration classified
I want to display information as
User Name User Email User Phone No Of Business No Of Classified
---------------------------------------------------------------------------------
Jose jose@yahoo.in 457855654 2 1
Tom tom@yahoo.in 5464644654 0 1
Nick nick@yahoo.in 4545645644 2 1
Rose rose@yahoo.in 554545441 1 2
So what is the mysql join query for getting this result, I am using php codeigniter 3.0 framework so it is nice, if anyone knows codeigniter query for this result?