SQL IF condition if GROUP BY statement
sql
Solution
SELECT *
FROM TABLE
GROUP BY case when order_id <> 0
then order_id
else other_field
end
Problem
I have some question about IF condition in SQL Is it possible to use the next syntax in SQL query? I`m interesting about if condition in group by statement ``` "SELECT * FROM TABLE WHERE... IF(order_id !=0, GROUP BY order_id, GROUP BY other_field)" ```