I am using formula function to add a column that gives out values based on certain condition. I am using case condition for validating the conditions, and I want it to be grouped by Req Id field. because req Id field contains multiple req Ids and have duplication. Idea behind grouping by is that if any of that condition is valid for even one row (Or Req Id) than basically flag all those req id as G or R or R1 etc... based on the condition that it flags against in the case statement.
I wrote the following querry, but it says syntax error. What am I missing?
GROUP BY `Req ID`
(CASE
WHEN `Req status`='Open' AND (`Offer to be Extended`<>'' OR `Offer Extended` <>'')
THEN 'G'
WHEN `Req status`='Open' AND (`HM applicant review`= 'Is null' AND `Days open`>10)
then 'R1'
WHEN `Req status`='Open' AND (`Interview`= '' AND `Days open`>15)
THEN 'R2'
WHEN `Req status`='Open' AND (`Req with Offer Accept`= 'Not Specified' AND `Days open`>35)
THEN 'R3'
Else'Y'
End
))