Say I have tbl_company with these
cid------- cons_no-------- company_name ------- phone ------ address
1---------- q1----------------aple------------------------22222-------newyork
2 ---------- q2----------------samsung----------------11111----------Ohio
3 ---------- q3 -------------- nokia ---------------------333333--------LONDON
tbl_company_track with these
id-------cid-------cons_no-------- branch_location ------- date_opened
1------- 1-----------q1---------------stamford------------------2010
2------- 1-----------q1---------------Kingsway------------------2011
3------- 1-----------q1---------------Cornerstone---------------2014
4------- 2-----------q2---------------Madison-------------------2001
5------- 3-----------q3---------------lewiston------------------2015
I want to be able to display on html
Cons_no-----company_name------ phone branck_location------date_opened
I want both table to correspond in respect to the cid and cons_no
so I can have record for one company:
Cons_no company_name phone branch date opened
q1 Aple 22222 stamford 2010
kingsway 2011
Cornerstone 2014
I HOPE I WAS ABLE TO COMMUNICATE MY PROBLEM WELL ENOUGH?
Best Answer
To answer this, I did the following (you can check out the SQLFiddle here).
And then ran the query
Which gives the result you want