編輯試圖列出具有任何其他項的數量大於同樣的工作子查詢使用條件選擇
Table items
+--------+----------+
| job_id | quantity |
+--------+----------+
| 004 | 150 |
| 004 | 4 |
| 004 | 100 |
| 002 | 50 |
| 002 | 2 |
| 002 | 17 |
| 002 | 17 |
| 006 | 2 |
+--------+----------+
我知道它應該是一個相當簡單的所有項目,但它讓我卡住。我試圖在查詢中使用ANY,但我不太確定如何使用它。這是我在想什麼:
select job_id, quantity
from items
where quantity >
(select min(quantity) from items) group by job_id;
我是那樣的。感謝您的幫助
select job_id, max(quantity) from po_items group by job_id;
那人做的伎倆
感謝它的伎倆 – Tom