select
 m.Name,
 mp1.Points as Round1,
 mp2.Points as Round2,
 mp3.Points as Round3,
 mp4.Points as Round4,
 mp5.Points as Round5
from
 member m,
 member_points mp1,
 member_points mp2,
 member_points mp3,
 member_points mp4,
 member_points mp5
where
        m.Id = mp1.Member__id
and m.Id = mp2.Member__id
and m.Id = mp3.Member__id
and m.Id = mp4.Member__id
and m.Id = mp5.Member__id
and m.Name = 'stefan'
and mp1.Round = 1
and mp2.Round = 2
and mp3.Round = 3
and mp4.Round = 4
and mp5.Round = 5


Best regards,
Mikhail.

----- Original Message -----
From: "Stefan Sturm" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 27, 2002 12:31 PM
Subject: sql-select


> Hello,
>
> I have a small(hopefully) sql-query problem.
> I have 2 table like this:
>
> Table member:
>
> Id number,
> Name varchar,
>
> Table member_points:
> Id number
> Member__id number (fk from member_table)
> Round number
> Points number
>
> Now one example:
> In table one is a member called stefan. In table member_points are 5
> sets for member stefan with his points for every round. Now I need one
> select, to give me his Name and all his points in _one_ row like this:
>
> Name round 1 round 2 round 3 round 4
> Stefan 10 15 8 12
>
> Who can help me?
>
> Greetings and thanks,
>
> Stefan
>
>
> ---------------------------------------------------------------------
> 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
>


---------------------------------------------------------------------
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