MySQL Forums
Forum List  »  Newbie

Query Help
Posted by: James Seymour
Date: March 29, 2006 06:27PM

I have been asked to write a query that lists all pairs of supplier numbers such that both suppliers are located in the same city. I have also been asked not to include any redundant or reversed pairs.

Here is a sample table:
+--------+---------+---------+----------+
| SUPPID | SNAME | SSTATUS | SCITY |
+--------+---------+---------+----------+
| S1 | Adams | 20 | Toronto |
| S2 | Barnes | 10 | Ottawa |
| S3 | Collins | 30 | Ottawa |
| S4 | Jones | 20 | Toronto |
| S5 | Emery | 30 | Kingston |
+--------+---------+---------+----------+

The Sample Return would be:
+--------+---------+
| SUPPID | SUPPID |
+--------+---------+
| S1 | S4 |
| S2 | S3 |
+--------+---------+

I have no idea how to tackle this query, any help would be appritiated.

Options: ReplyQuote


Subject
Written By
Posted
Query Help
March 29, 2006 06:27PM
March 29, 2006 07:33PM
March 30, 2006 05:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.