JohnandSwifty
Technical User
Hi,
I'm returning the error Incorrect syntax near '1' when I run a query with the following case statement. It is possible that the orderProduct.sequence does have a value of 1, but I can't see why this would cause an issue...
Any ideas would be great.
CASE
WHEN orderProduct.sequence > 0 AND orderProduct.sequence <= 5 THEN '1-5'
WHEN orderProduct.sequence > 5 AND orderProduct.sequence <= 10 THEN '6-10'
WHEN orderProduct.sequence > 10 AND orderProduct.sequence <= 15 THEN '11-15'
WHEN orderProduct.sequence > 15 AND orderProduct.sequence <= 20 THEN '16-20'
WHEN orderProduct.sequence > 20 AND orderProduct.sequence <= 25 THEN '21-25'
WHEN orderProduct.sequence > 25 AND orderProduct.sequence <= 30 THEN '26-30'
WHEN orderProduct.sequence > 30 AND orderProduct.sequence <= 35 THEN '31-35'
WHEN orderProduct.sequence > 35 AND orderProduct.sequence <= 40 THEN '36-40'
WHEN orderProduct.sequence > 40 AND orderProduct.sequence <= 45 THEN '41-45'
WHEN orderProduct.sequence > 45 AND orderProduct.sequence <= 50 THEN '46-50'
WHEN orderProduct.sequence > 50 AND orderProduct.sequence <= 55 THEN '51-55'
WHEN orderProduct.sequence > 55 AND orderProduct.sequence <= 60 THEN '56-60'
WHEN orderProduct.sequence > 60 AND orderProduct.sequence <= 65 THEN '61-65'
WHEN orderProduct.sequence > 65 AND orderProduct.sequence <= 70 THEN '66-70'
WHEN orderProduct.sequence > 70 AND orderProduct.sequence <= 75 THEN '71-75'
ELSE '75+'
END AS sequenceGroup
I'm returning the error Incorrect syntax near '1' when I run a query with the following case statement. It is possible that the orderProduct.sequence does have a value of 1, but I can't see why this would cause an issue...
Any ideas would be great.
CASE
WHEN orderProduct.sequence > 0 AND orderProduct.sequence <= 5 THEN '1-5'
WHEN orderProduct.sequence > 5 AND orderProduct.sequence <= 10 THEN '6-10'
WHEN orderProduct.sequence > 10 AND orderProduct.sequence <= 15 THEN '11-15'
WHEN orderProduct.sequence > 15 AND orderProduct.sequence <= 20 THEN '16-20'
WHEN orderProduct.sequence > 20 AND orderProduct.sequence <= 25 THEN '21-25'
WHEN orderProduct.sequence > 25 AND orderProduct.sequence <= 30 THEN '26-30'
WHEN orderProduct.sequence > 30 AND orderProduct.sequence <= 35 THEN '31-35'
WHEN orderProduct.sequence > 35 AND orderProduct.sequence <= 40 THEN '36-40'
WHEN orderProduct.sequence > 40 AND orderProduct.sequence <= 45 THEN '41-45'
WHEN orderProduct.sequence > 45 AND orderProduct.sequence <= 50 THEN '46-50'
WHEN orderProduct.sequence > 50 AND orderProduct.sequence <= 55 THEN '51-55'
WHEN orderProduct.sequence > 55 AND orderProduct.sequence <= 60 THEN '56-60'
WHEN orderProduct.sequence > 60 AND orderProduct.sequence <= 65 THEN '61-65'
WHEN orderProduct.sequence > 65 AND orderProduct.sequence <= 70 THEN '66-70'
WHEN orderProduct.sequence > 70 AND orderProduct.sequence <= 75 THEN '71-75'
ELSE '75+'
END AS sequenceGroup