Can anyone figure out this MySQL query?
From: <do-not_at_spam.me>
Date: Wed, 30 Aug 2000 08:40:57 GMT
Message-ID: <39acc88f.73770416_at_news.arnes.si>
|InvoiceNo | HotelNo | CustomerNo|
Date: Wed, 30 Aug 2000 08:40:57 GMT
Message-ID: <39acc88f.73770416_at_news.arnes.si>
Hi;
+-------------------------|
|1 | Bob |
|2 | George |
|3 | Fred |
+-------------------------+
Invoices
+--------------------------------+
|InvoiceNo | HotelNo | CustomerNo|
+--------------------------------+
|1 | 1 | 1 |
|2 | 1 | 2 |
|3 | 2 | 1 |
|4 | 2 | 2 |
|5 | 3 | 3 |
|6 | 3 | 1 |
+--------------------------------+
Now, on to my query: I'd like to SELECT the all records FROM Invoices
WHERE for example CustomerNo 1 AND CustomerNo 2 stayed at the same
hotels. In this case it should match InvoiceNo 1,2,3,4 BUT NOT 5,6
Obviously I'd like to query by CustomerName so I'd like to use an
inner join for that, but that part is OK. Any ideas?
Many Thanks
Chris