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.
select * from car where carbrand = 'bmw' limit 1 union select * from car where carbrand = 'mercedez'
Unionを使用せずにこのクエリを組み合わせることができますか?
試す
SELECT * FROM car WHERE carbrand IN ('bmw', 'mercedez') GROUP BY carbrand
編集:
SELECT * FROM car WHERE carbrand IN ('bmw', 'mercedez') GROUP BY CASE WHEN carbrand = 'bmw' THEN carbrand ELSE car_id END
上記のELSEcar_id状態で見て、それぞれのIDを入力してください。
car_id