Hi All,
I am querying data from a number of spreadsheets into another spreadsheet. One of the columns which I wish to sort on contains the values 'Very Simple', 'Simple', 'Standard', 'Complex', 'Very Complex' and that if the order I wish them to be sorted in.
I thought that the easiest way to do this was to create another column with a CASE statement as follows:
SELECT `R13#0$`.`Component Type`, `R13#0$`.Complexity, `R13#0$`.`Level of Impact`,
CASE `R13#0$`.Complexity
WHEN 'Very Simple' THEN 1
WHEN 'Simple' THEN 2
WHEN 'Standard' THEN 3
WHEN 'Complex' THEN 4
WHEN 'Very Complex' THEN 5
ELSE 0
END
FROM `R13#0$` `R13#0$`
From an standard Ansi SQL point of view, I believe I have the syntax correct but MS Query is returning:
Didn't expect 'WHEN' after the SELECT column list
Anybody got any ideas as I've tried a number of different syntaxes and just can't get it to work.
Marc
I am querying data from a number of spreadsheets into another spreadsheet. One of the columns which I wish to sort on contains the values 'Very Simple', 'Simple', 'Standard', 'Complex', 'Very Complex' and that if the order I wish them to be sorted in.
I thought that the easiest way to do this was to create another column with a CASE statement as follows:
SELECT `R13#0$`.`Component Type`, `R13#0$`.Complexity, `R13#0$`.`Level of Impact`,
CASE `R13#0$`.Complexity
WHEN 'Very Simple' THEN 1
WHEN 'Simple' THEN 2
WHEN 'Standard' THEN 3
WHEN 'Complex' THEN 4
WHEN 'Very Complex' THEN 5
ELSE 0
END
FROM `R13#0$` `R13#0$`
From an standard Ansi SQL point of view, I believe I have the syntax correct but MS Query is returning:
Didn't expect 'WHEN' after the SELECT column list
Anybody got any ideas as I've tried a number of different syntaxes and just can't get it to work.
Marc