I am using MS Query in Excel 2010. I have two tables and I am appending them together. colG is then added. ColA has dates and in colG I want to diplay a message about how long ago the date is from the current date. I am having issues using DateDiff within a switch statement. Any ideas what is wrong? Here is what I have so far:
SELECT `Sheet1$`.colA, `Sheet1$`.colB,
Switch(
1<DateDiff('m', #colA#, CURRENT_TIMESTAMP) < 2, '1-2 months',
2<DateDiff('m', #colA#, CURRENT_TIMESTAMP) < 4, '2-4 months',
4<DateDiff('m', #colA#, CURRENT_TIMESTAMP)< 6, '4-6 months',
6<DateDiff('m', #colA#, CURRENT_TIMESTAMP)< 9, '6-9 months',
DateDiff('m', #colA#, CURRENT_TIMESTAMP)> 9, '+9 months'
)AS colG
FROM (
SELECT `Sheet1$`.colA, `Sheet1$`.colB
FROM `Sheet1$` `Sheet1$`
UNION ALL
SELECT `Sheet2$`.colC, `Sheet2$`.colD
FROM `Sheet2$` `Sheet2$`
) t;