I had finished an indepth post on this before my PC crashed I don't have that much time anymore so hopefully this will be enough, please ask any questions and I will try anmd get back to you.
I have a query that works fine, but when I try to put it into a cross-tab it tells me it can't find the fields in the sub-query (the alias'ed table).
Any ideas please?
this is the one that works:Q_LABEL_FORMAT_01
This is the crosstab:
Thank you
I have a query that works fine, but when I try to put it into a cross-tab it tells me it can't find the fields in the sub-query (the alias'ed table).
Any ideas please?
this is the one that works:Q_LABEL_FORMAT_01
Code:
SELECT T_SKUMaster.SKU_ID, T_SKUMaster.SKUCode, (select count(*) from [T_SKU_vs_LabelFormat] where [ID]<[T_SKU_vs_LabelFormat2].[ID] AND [SKU_ID]=[T_SKU_vs_LabelFormat2].[SKU_ID] ;)+1 AS Rank, T_Labels.FileName, "FORMAT0" & [Rank] & " TITLE" AS FormatTitle, T_Labels.Title, "FORMAT0" & [Rank] & " PATH" AS FormatPath
FROM (T_SKU_vs_LabelFormat AS T_SKU_vs_LabelFormat2 RIGHT JOIN T_SKUMaster ON T_SKU_vs_LabelFormat2.SKU_ID = T_SKUMaster.SKU_ID) LEFT JOIN T_Labels ON T_SKU_vs_LabelFormat2.LabelID = T_Labels.LabelID
ORDER BY T_SKUMaster.SKUCode;
This is the crosstab:
Code:
[b]Q_LABEL_FORMAT_02_TITLES[/b]
TRANSFORM First(Q_LABEL_FORMAT_01.Title) AS FirstOfTitle
SELECT Q_LABEL_FORMAT_01.SKU_ID, Q_LABEL_FORMAT_01.SKUCode
FROM Q_LABEL_FORMAT_01
GROUP BY Q_LABEL_FORMAT_01.SKU_ID, Q_LABEL_FORMAT_01.SKUCode
ORDER BY Q_LABEL_FORMAT_01.SKUCode
PIVOT Q_LABEL_FORMAT_01.FormatTitle;
Thank you