MySQL Forums
Forum List  »  General

[Query help] Table transformation
Posted by: Bojan Tomic
Date: March 16, 2010 04:13PM

I'm utterly stuck and desperately need help from someone with more experience.
I have a table with a locale column (that can only have two values) and need to transform it into a table with one column for each of the two locales. Here's a simple but a complete example:

the following table
key   | name     | locale
1     | oneEng   | eng
1     | oneSwe   | swe
2     | twoEng   | eng
3     | threeSwe | swe

needs to be transformed into this:
key   | engName  | sweName
1     | oneEng   | oneSwe
2     | twoEng   | (NULL)
3     | (NULL)   | threeSwe

Obviously, the problematic thing is that some entries only have a version for one locale and not both...

Any ideas how to do this? Or a confirmation that it's impossible... I'd greatly appreciate it.

Edited 1 time(s). Last edit at 03/16/2010 05:06PM by Bojan Tomic.

Options: ReplyQuote

Written By
[Query help] Table transformation
March 16, 2010 04:13PM

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.