I'm having an issue with MySQL .
I have 2 Tables :
Table A Table B
userId userId
name email
email
It's a relation 1->N (1 user can have multiple emails in Table B)
Now i want to import my users into a mail program , i want to make it in 1 query instead of multiple query .
What i would like to have is the following :
user id , name , email
ex:
1 , John Doe , [email protected] (This email comes from Table A)
1 , John Doe , [email protected] (This email comes from Table B)
Currently i have the following query That returns multiple row but the problem is that the fields are not the same
i get something like :
Table A.name , Table A.email , Table B. email etc ..
SELECT
jos_users.userId,
jos_members_webAddress.email2,
jos_users.uniqueId,
jos_users.firstName,
jos_users.lastName,
jos_users.username,
jos_users.email
FROM
jos_users
INNER JOIN jos_members_webAddress ON jos_users.userId = jos_members_webAddress.memberId
Thanks for the help
tableA, N-1 emails intableB. Without the email intableA, you would have N emails intableB, and no pesky exceptional cases intableA.