Hi,
I'm writting a multilingual news system and I have this two table (here I will simplify it)
Code:
TABLE news(
newsid mediumint(8) NOT NULL PRIMARY KEY
#other info
);
TABLE newscontent(
newsid mediumint
languageid varchar(5)
UNIQUE(newsid,languageid)
#inof like title, content....
);
Now what I want to do is is select all news with the current language, if a news isn't translated then select the défault (english).
I mean this won't work :
Code:
SELECT news.*, newscontent.* FROM news, newscontent WHERE news.newsid=newscontent.newsid
SELECT news.*, newscontent.* FROM news, newscontent WHERE news.newsid=newscontent.newsid AND newscontent.languageid=$currentlanguage
The first one select all availlable language for each news.
The seconde doesn't select a news if no translation is availlable (here we must also show english).
I want to have a single row for each news.
Any idea about an sql command that could do this ?
Maybe it's not possible in MySQL and I have to code the language selection separately ?
I'm quite sure that MySQL can do it much faster than a coded thing (currently PHP).
Thanks.