I am trying to get "default" value for every ID of JOIN if ON clause were 
unsucessfull.

In my example, I am trying to get "english" rows, but if they are not 
available, I would like to get
default - "estonian".

I have two tables ie.

table1:
id
1
2
3

table2:
id - lang - desc
1 - english - EN_A
1 - estonian - ES_A
2 - english - EN_B
2 - estonian - ES_B
3 - estonian - ES_C

now if I join these two tables ie.:
SELECT * FROM table1 LEFT JOIN table2 ON table1.id=table2.id AND table2.lang 
='english' GROUP BY
table1.id;

I am getting:
--
id - id - lang - desc
1 -  1 - english - EN_A
2 -  2 - english - EN_B
--

But I would to have "default" row if english is not available:

--
id - id - lang - desc
1 -  1 - english - EN_A
2 -  2 - english - EN_B
3 -  3 - estonian - ES_C
--

I have tried with UNION of two JOINTS (one for english, one for estonian) but 
then I am getting
duplicate rows with ID=(1,2)

Thanx


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

Reply via email to