It works fine (with a little tweak).

SELECT DISTINCT CASE WHEN c1.winner_1 = c1.winner_2 THEN c1.winner_1 ELSE c1.winner_2 
END AS winner FROM champions c1,champions c2 ORDER BY winner ASC

is what I wanted. Thank you very much! Btw, I can't help my webhotel is rotten and 
only uses old versions. But it's cheap :)

/Carl

-----Ursprungligt meddelande-----
Från: Jochem van Dieten [mailto:[EMAIL PROTECTED] 
Skickat: den 17 februari 2004 16:44
Till: Carl Schéle, IT, Posten
Kopia: [EMAIL PROTECTED]
Ämne: Re: SQL-HELP

Carl Schéle, IT, Posten wrote:
> 
> I got a table, champions, looking like this:
> 
> id                   winner_1         winner_2
> --------------------------------------------------------
> 0                    carl                 mattias
> 1                    daniel             carl
> 2                    erik                 daniel
> 3                    erik                 johan
> 
> What I want is to retrieve the unique names ie:
> 
> carl
> mattias
> daniel
> erik
> johan
> 
> I use MySQL 3.23.58 (which means I can't use sub-selects).

The smart way: get a database that understands UNION.

The other way:
SELECT DISTINCT
        CASE
                WHEN c1.id = c1.id THEN c1.winner_1
                ELSE c1.winner_2
        END AS winner
FROM
        champions c1,
        champions c2

Jochem

-- 
I don't get it
immigrants don't work
and steal our jobs
     - Loesje




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

Reply via email to