Hey, I am doing a bit of sql here and am getting data from multiple tables. All is good apart from where I have a table with multiple values for a user. Such as a user may have two address for instance. This is taken from the address table.
The sql I have is as follows:
SELECT u.user_id, u.title, u.lastname, u.firstname, u.gender,
u.birthdate, u.hphone u, d.pname, d.citizen, d.program,
a.paddress, a.city, a.state, a.country, a.postcode
FROM USERS u, STUDENT_DETAILS d,
USERS_ADDRESS a
WHERE (user_role = '6') AND (u.user_id = d.user_id) AND
(u.user_id = a.user_id)
ORDER BY u.lastname ASC
The problem is, if a user has two address, it will output their name twice eg
Joe Blogg Address 1
Joe Blogg Address 2.
What I want is:
Joe Blogg Address1, Address 2
Will I need to do a seperate sql statement here to achieve this? or can I do it all in the one statement?
Cheers