Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DISTINCTing two but returning one 1

Status
Not open for further replies.

1510982

Programmer
Feb 17, 2002
57
SI
Let's say we have a linking table for three tables.

tbl_SPJ
-----------------
sID | pID | jID |
1 2 3
1 2 4
2 3 6
1 5 3
-----------------

Is it possible now to have distinct like:

"SELECT DISTINCT sID, jID FROM tbl_SPJ"

and then returning only (3,4,6) instead of ((1,3),(1,4),(2,6)).

I hope I was clear enough. Thank you for your replies, I really appreciate it.

 
Thanks, swamBoogie.

I cannot output pID (2, 2, 3),however,right?

Regards.
 
select min(pID) from tbl_spj group by sid,jid;

But why pID(2, 2, 3) instead of pID(2, 2, 5)?

Dieter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top