morning all,
have the following sql from a crosstab query:
where ConfirmedDate is in the format yyyy/mm/dd-hh:mm:ss.
this works just fine when you wish to pivot on the month only. however, i was just wondering if it can be modified to pivot based on the day also.
so rather than pivot based on january (month 01) i could pivot on month and day - say 2008/12/28 thru 2009/01/27.
the beginning would always be the 28th of the previous month and the end would always be the 27th of the 'current' month. the query will usually be run in ranges - a whole year or a quarter. any thoughts or suggestions on how i should approach? can this be done in one query? or am i better off breaking out the date into seperate fields and assigning a numeric value to a field (where 2008/12/28 - 2009/01/27 would be 1, 2009/02/28 - 2009/03/27 would be 2, etc.) and then do the crosstab on that field.
thanks.
regards,
longhair
have the following sql from a crosstab query:
Code:
TRANSFORM Sum([PCS]/Right$(tblMasterCartons![um-code],2)) AS Expr1
SELECT tbl2009Shipping1.SKU
FROM tbl2009Shipping1 INNER JOIN tblMasterCartons ON tbl2009Shipping1.SKU = tblMasterCartons.[product]
GROUP BY tbl2009Shipping1.SKU
PIVOT Mid([ConfirmedDate],6,2);
this works just fine when you wish to pivot on the month only. however, i was just wondering if it can be modified to pivot based on the day also.
so rather than pivot based on january (month 01) i could pivot on month and day - say 2008/12/28 thru 2009/01/27.
the beginning would always be the 28th of the previous month and the end would always be the 27th of the 'current' month. the query will usually be run in ranges - a whole year or a quarter. any thoughts or suggestions on how i should approach? can this be done in one query? or am i better off breaking out the date into seperate fields and assigning a numeric value to a field (where 2008/12/28 - 2009/01/27 would be 1, 2009/02/28 - 2009/03/27 would be 2, etc.) and then do the crosstab on that field.
thanks.
regards,
longhair