我想運行一個查詢來返回客戶的姓和名,只有當他們用於會話的IP地址不同時。MySQL根據差異返回
例如:
Customer 1 makes Order on Session IP address: 192.168.12.1
Customer 1 makes Order on Session IP address: 192.168.12.2
Customer 2 makes Order on Session IP address: 192.168.12.3
Customer 2 makes Order on Session IP address: 192.168.12.3
Return Customer where IP address is not same (Customer 1)
不過,我不知道如何來指定IP地址的差異。
我目前擁有的是:
Select Cust_First, Cust_Last
FROM customer
LEFT join Session
On customer.cust_ID = session.Cust_ID
LEFT join Order
On session.Ses_ID = order.Session_ID
Where Ses_IPAddress # Is different for the same customer?
我會詳細的必要的字段的表:
Customer:
PK: Cust_ID
row: Cust_First
row: Cust_Last
Session:
PK: Ses_ID
FK: Cust_ID
Row: Ses_IPAddress
Order:
PK: Order_ID
FK Ses_ID
我的$ 0.02 - 嘗試按'Ses_IPAddress' – ajreal