I have a table with (amongst others) the columns "pid" and "countrycode" (char and varchar). Pid stands for "PageId". I want a recordset that includes the pid for the countrycode "se" and also includes the pid for the cuntrycodes "de" and "eu", if there are any pid:s for these countries. If a pid is missing from either "eu" or "de" I still want to include the row.
My table columns:
|countrycode|pid|
I want my recordset to look like this:
|pid|se.countrycode|de.countrycode|eu.countrycode|
_________________________________________________
|startpage|se|de|eu| (if "startpage" is defined for all countrycodes)
|startpage|se|de|null| (if "startpage" is defined for the countrycodes "se" and "de")
Am I making any sense?
It doesn´t matter if I use "INNER", "OUTER", "LEFT", "RIGHT" or "FULL" joins, i always get the same no good result.
Here´is my statement, where I have tried with only two different countrycodes:
SELECT se.pid AS PAGE, se.CountryCode AS SWEDEN, de.CountryCode AS GERMANY
FROM wa_PageContent se LEFT OUTER JOIN
wa_PageContent de ON se.pid = de.pid
WHERE (se.KeyPage = 1) AND (se.CountryCode = 'se') AND (de.KeyPage = 1) AND (de.CountryCode = 'de')
ORDER BY se.Script, se.pid, se.SortOrder
My table columns:
|countrycode|pid|
I want my recordset to look like this:
|pid|se.countrycode|de.countrycode|eu.countrycode|
_________________________________________________
|startpage|se|de|eu| (if "startpage" is defined for all countrycodes)
|startpage|se|de|null| (if "startpage" is defined for the countrycodes "se" and "de")
Am I making any sense?
It doesn´t matter if I use "INNER", "OUTER", "LEFT", "RIGHT" or "FULL" joins, i always get the same no good result.
Here´is my statement, where I have tried with only two different countrycodes:
SELECT se.pid AS PAGE, se.CountryCode AS SWEDEN, de.CountryCode AS GERMANY
FROM wa_PageContent se LEFT OUTER JOIN
wa_PageContent de ON se.pid = de.pid
WHERE (se.KeyPage = 1) AND (se.CountryCode = 'se') AND (de.KeyPage = 1) AND (de.CountryCode = 'de')
ORDER BY se.Script, se.pid, se.SortOrder