Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
テーブルにアイテムのリストがあり、名前でグループ化して合計を取得しています。これらのアイテムのいくつかは名前が NULL で、グループ化したくありません。
これを試して:
SELECT itemname, SUM(whatever) FROM tab WHERE itemname IS NOT NULL GROUP BY itemname UNION ALL SELECT itemname, whatever FROM tab WHERE itemname IS NULL