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.
このクエリを正しい構文にするにはどうすればよいですか? (MySQL)
ありがとうございました。
SELECT (count(a) WHERE a = 1)-(count(a) WHERE a = 0) FROM table
これを試して。
SELECT SUM(CASE WHEN a=1 THEN 1 ELSE 0 END)- SUM(CASE WHEN a=0 THEN 1 ELSE 0 END) AS Result FROM table