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