MySQL Forums
Forum List  »  Newbie

Re: How to model an i18n table and how to query it
Posted by: Aziz
Date: July 24, 2005 12:57PM

Forget the complicated multiple self-join construct. I figured out a nifty query that does a much better and more efficient job:

[sql]
SELECT IN_ID
, GROUP_CONCAT( CASE lang WHEN 'en' THEN resource END ) AS en
, GROUP_CONCAT( CASE lang WHEN 'de' THEN resource END ) AS de
, GROUP_CONCAT( CASE lang WHEN 'ur' THEN resource END ) AS ur
FROM i18n
GROUP BY IN_ID
[/sql]

It works equally well if you use the MAX aggregate function instead of GROUP_CONCAT, however, in my benchmark tests I perceived the GROUP_CONCAT function to be a bit faster than the MAX function.

If you can improve the query any further, please don't hesitate to post your suggestion.

Options: ReplyQuote


Subject
Written By
Posted
Re: How to model an i18n table and how to query it
July 24, 2005 12:57PM
July 26, 2005 11:22AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.