I\'m trying to create a (sqlite) query that will perform a GROUP BY but will not group anything with the value \'unknown\'. For example, I have the table:
i
You can't easily do this with one statement but you can UNION the results of two statements
GROUP the list of all but unknownUNION) the list of all unknownSQL Statement
SELECT MIN(id), name, parent_id, school_id
FROM YourTable
WHERE name <> 'unknown'
GROUP BY
name, parent_id, school_id
UNION ALL
SELECT id, name, parent_id, school_id
FROM YourTable
WHERE name = 'unknown'
Note that I assume you have posted wrong unknown id's in your result