這是表結構: (這是一個日誌)MySQL的 - 檢查列值(IP)出現在多個引用(訂單)
柱
order id, IP, text, timestamp
我的數據是這樣的:
ORDERREF1 | 192.168.0.1 | Some text about order | TIMESTAMP
ORDERREF1 | 192.168.0.1 | Some text about order | TIMESTAMP
ORDERREF2 | 192.168.0.2 | Some text about order | TIMESTAMP
ORDERREF3 | 192.168.0.3 | Some text about order | TIMESTAMP
ORDERREF5 | 192.168.0.1 | Some text about order | TIMESTAMP
ORDERREF3 | 192.168.0.3 | Some text about order | TIMESTAMP
ORDERREF4 | 192.168.0.4 | Some text about order | TIMESTAMP
ORDERREF2 | 192.168.0.2 | Some text about order | TIMESTAMP
從上面的數據可以看出,一個IP出現在兩個orderrefs中。
我需要一個查詢,告訴我在MULTIPLE orderid中出現了什麼IP以及它們引用了哪些orderid。
所以結果非常發出這樣的:
ORDERREF1 | ORDERREF5 | 192.168.0.1
由於知識產權在多個orderref的其唯一的結果出現使用下面的查詢,你會得到多個條目
我編輯了我的原始問題,並提供了有關需要的結果請求的其他詳細信息 –
@JamieEde我已更新我的答案 – Shogunivar