I thought this would be very simple, but I can't seem to figure it out ...
Here's the scenario:
I have a users table and a phones table. The phones table can contain several phone records for a unique user, eg:
phID usID phone type
1 1 555-1212 h
2 1 555-2121 w
3 2 555-9955 h
I would like to return only one phone record per user (phone type doesn't matter). My current query ...
SELECT a.firstName, a.lastName, b.phone
FROM users a LEFT OUTER JOIN
phones b ON a.usID=b.usID
... returns 3 records. I would like it to return 2 records.
What can I do?
Thanks in advance.
Here's the scenario:
I have a users table and a phones table. The phones table can contain several phone records for a unique user, eg:
phID usID phone type
1 1 555-1212 h
2 1 555-2121 w
3 2 555-9955 h
I would like to return only one phone record per user (phone type doesn't matter). My current query ...
SELECT a.firstName, a.lastName, b.phone
FROM users a LEFT OUTER JOIN
phones b ON a.usID=b.usID
... returns 3 records. I would like it to return 2 records.
What can I do?
Thanks in advance.