-2
我有一個表命名爲batch
與MySQL選擇查詢時遇到
batch_id unit_size product_id
2 100000 c001
3 30000 t008
命名爲batch_process
batch_id process_id status
2 100000 0
2 100000 1
2 100000 2
2 100000 1
3 30000 2
3 30000 2
3 30000 2
3 30000 2
現在我想輸出3
AS batch_id
形式batch
表,因爲在batch_process
表中的所有其他表process_id
狀態爲2
爲batch_id = 3
如何選擇它。
不清楚!你能展示一個樣本輸出嗎? – Damodaran
就像這樣:http://sqlfiddle.com/#!2/aecc39/2? – Passerby
@Passerby它的工作原理。謝謝你的幫助 –