Is there any way to make an if in group by clause?
I have a query in which I want to group the result based on a column value
if the column is Null, I want the result to remain as it is, but if not, do I want to group it by this value? how do you do it
Edit: Sorry, I think I should add a more specific example
the columns below contain category id, stream and response
this is for the forum
those with zero values ββmean they have no answer in them
if the answer is empty, I do not want to group it
the goal is to count responses and flows within a category
i did not set the value for the response as null, they are similar to the connection result
| category | thread | reply | ------------------------------- | 1 | 1 | 1 | | 1 | 1 | 2 | | 1 | 2 | 3 | | 2 | 3 | 4 | | 3 | 4 | 5 | | 3 | 4 | 6 | | 4 | 5 | null | | 5 | 6 | null |
then the result will be
| category | thread | reply | ----------------------------- | 1 | 3 | 3 | | 2 | 1 | 1 | | 3 | 2 | 2 | | 4 | 1 | null | | 5 | 1 | null |
source share