0
我想生成一個查詢,它允許我根據以前的可用記錄選擇多個記錄。讓我解釋。MySQL Select Query - 限制不記錄計數,但返回結果的類型
我有一個表,其中包含3個不同的客戶端和地區依賴100條記錄。即
Record 1 belongs to client 1 and appears in regions: 1, 2, 3
Record 2 belongs to client 1 and appears in regions: 1, 2
Record 3 belongs to client 2 and appears in regions: 1, 2
Record 4 belongs to client 3 and appears in regions: 2, 3
現在,如果我進入區域1作爲我的選項來搜索,我會看到創紀錄的1,2,3,如果我進入區域2作爲我的選擇,我想看到的記錄1,2,3但沒有記錄4,因爲我已經有2個其他客戶。現在
,如果我進入區域3爲我的選擇,我想有一個返回的記錄1,4
我基本上想要做的結果,但不是在記錄的金額退回的限制,但對不同的地區。因此,顯示前兩個可用區域的所有記錄。
希望這可以做到。
乾杯