Hi all,

My first post to this list.

I have a query which I can't quite get to work. I was hoping that someone here could educate me a bit. I have two tables.

tbl_people

|  id    |     fname    |    lname    |
---------------------------------------
|  1     |    frank       |    smith      |


tbl_peoples_interests



| id | interest_id | person | ------------------------------------------ | 1 | 500 | 1 | | 2 | 504 | 1 |

So... basically what I am trying to do is find the person and join them with their interests, but I need to get ALL their interests and I need to be able to access the values of each interest separately. Here is what I have, but both


SELECT DISTINCT p.fname AS firstname, p.lname AS lastname, int_1.interest_id AS int_a, int_2.interest_id AS int_b FROM tbl_personnel AS p, tbl_peoples_interests AS int_1, tbl_peoples_interests AS int_2 WHERE int_1.person = p.id AND int_2.person = p.id AND p.id = 1


what I get back has 500 for both int_a and int_b

Thanks
Charles




--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Reply via email to