What would be the rules for deciding if id 3 should be fr or de? 

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

Michael Shuler, C.E.O.
BitWise Systems, Inc.
1301 W. Pioneer Parkway
Peoria, IL 61615
Office: (217) 585-0357
Cell: (309) 657-6365
Fax: (309) 213-3500
E-Mail: [EMAIL PROTECTED]
Customer Service: (877) 976-0711

-----Original Message-----
From: ighen [mailto:[EMAIL PROTECTED] 
Sent: Sunday, December 21, 2003 4:50 PM
To: [EMAIL PROTECTED]
Subject: Getting a particular row from GROUP BY


Hello,

I have the next table (the primary key is id+language):

||  id  ||  language  ||    title    ||
---------------------------------------
    1          de        {some_text}
    1          en        {some_text}
    1          fr        {some_text}
    2          fr        {some_text}
    2          de        {some_text}
    2          en        {some_text}
    3          fr        {some_text}
    3          de        {some_text}

I want to group all rows with the same id, and sort the grouped rows with
the title field of the 'en' language. I use the next query:

SELECT * FROM table GROUP BY id,language HAVING language='en' ORDER BY
title;

This returns:
1, en
2, en
How can I do that it will return me the following?
1, en
2, en
3, fr

I also tried the next query:
SELECT * FROM table GROUP BY id,language='en' ORDER BY title; but it
returned me twice the id 1 and 2.

thanks in advance,
-Eli

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.554 / Virus Database: 346 - Release Date: 12/20/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.554 / Virus Database: 346 - Release Date: 12/20/2003
 


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

Reply via email to