MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Uttam Date:March 16 2003 8:17am
Subject:RE: Newbie Query Question
View as plain text  
is a crosstab is what you want?

pls. give the result (output of the query) that you expect from the example
and what you are actually getting.

regds,

-----Original Message-----
From: Charles Kline [mailto:ckline@stripped]
Sent: Saturday, March 15, 2003 20:53
To: mysql@stripped
Subject: Newbie Query Question


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




Thread
Newbie Query QuestionCharles Kline15 Mar
  • Re: Newbie Query QuestionJeff Kilpatrick15 Mar
    • Re: Newbie Query QuestionCharles Kline15 Mar
      • Re: Newbie Query QuestionJeff Kilpatrick15 Mar
  • RE: Newbie Query QuestionUttam16 Mar