Hi,
I'm new to this and I'm sure it must be something simple/silly that I'm missing!
I have 2 tables which have the following structure:
table 1
id | client name
table 2
id | title | client_id | .....more cols
I want to reference both tables, list the distinct client_ids from table 2 showing the client_name which appears in table 1.
That part has worked fine so far using:
SELECT DISTINCT
table1.id,
table1.client_name
FROM table1,
table2
WHERE table1.id=table2.client_id
ORDER BY client_name
My trouble is that now, I need to be able to retrieve table2.id as well and then reference it in my php when I create a list on my html page.
Can anyone tell me how I do this? I have tried lots of combinations of things but just seem to be getting it wrong every time.
thank you in advance