Reputation: 3
I have one table rewards that has rewards info, each reward has some basic info such as count, id, title, message & description. To be able to localize we give ID`s to these text items.
I have another table languages, where we keep all text messages, along with key ID & language ID.
What I need is a query to get all rewards along with localized text from the table. For example, if I pass language as English (lang_id
is 1 in language table), it should return all rewards with English text.
How do I do this?
Upvotes: 0
Views: 476
Reputation: 626
select * from
rewards, languages
where rewards.id = languages.key_id
and languages.lang_id = 1;
P.S. when asking questions on stackoverflow, you should show at least some research effort - what you tried and what haven't worked. Probably, you do not realise, that if you want to retrieve information from two tables at once, you should use JOIN in sql.
Here is a link that might be helpful in your further research:
Upvotes: 2