I'm still a beginner myself but try something like

SELECT COUNT(YEAR), WINNER1 AS WINNER, WINNER2 AS WINNER, YEAR FROM
CHAMPIONS WHERE CLASS = "hd" GROUP BY WINNER;

I think this will give you something like:

COUNT(YEAR)                     WINNER          YEAR
        2                       carl                    1957
        2                       carl                    1985
        1                       mattias                 1957
        1                       erik                    1985

Again I am a beginner and would have to test this to see if it actually
gives me the right info or if I would have to "tweek" it.

Respectfully,
Ligaya Turmelle
Computer Programmer
Guam International Country Club
495 Battulo Street
Dededo, Guam 96912
Tel: (671) 632-4445
Fax: (671) 632-4440
Reservations: (671) 632-4422 (GICC)

-----Original Message-----
From: Carl Schéle, IT, Posten [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 19, 2004 6:50 PM
To: [EMAIL PROTECTED]
Subject: SQL-help needed


Hi!



I got a table, champions, looking like this:



id        class     winner_1              winner_2             year

---------------------------------------------------------------------

0          hd         carl                  mattias              1957

1          hs         daniel                                     1982

2          hd         erik                  carl                 1985

3          js         erik                                       1974



Imagine I want to see how many times each winner appears where class=hd and
which year. In this case the answer would be:



2 carl 1957,1985

1 mattias 1957

1 erik 1985



Please help! Still using old MySQL 3.23.58.








-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to