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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The easiest(quickiest) way to select distinct only for a number of fie 1

Status
Not open for further replies.

xcata

Programmer
Jun 27, 2001
39
FR
Hi,

Which is the quickest way to select distinct only for a number of fields.
For example I have:
select f1,f2,f3,...
from tbl

I wont a kind of(only for ideea, syntax incorrect):
select (distinct f1,f2) f3,f4,....
from tbl
Ex:
f1 f2 f3 f4
1 1 2 5
1 2 1 2
2 1 2 3
2 1 2 4

The recordset must have(distinct for the first 2 fields):
f1 f2 f3 f4
1 1 2 5
1 2 1 2
2 1 2 3 this or the next not both
2 1 2 4




 

select f1, f2, max(f3) As f3, Max(f4) as f4
from tbl
Group By f1, f2
Terry L. Broadbent
Life would be easier if I had the source code. -Anonymous
 
Hi,

Thanx Terry, it'a really simple solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top