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!

How to get the FIRST occurance of a non-GROUP BY field

Status
Not open for further replies.

ProtocolPirate

Programmer
Joined
Nov 21, 2007
Messages
104
Location
US
There are 4 fields I want to display, but I can only do a GROUP BY on three of the fields. I don't want these three fields repeated in other rows if the 4th field changes for some of the records, so I can't GROUP BY the 4th field. Yet I still want to display SOMETHING for the 4th field, just the first occurance would be great.

So how can I get the first occurance of a field for a group of records that are summarized in a single row of output? That is to say, the GROUP BY reduces a number of rows down to one row, and the records associated with this one group-by row have different values for the 4th field, so how can I display the first or just one occurance of the value in that field along side the other GROUP BY fields?
 
Duh... The MIN() function...

As Rosan Rosana Dana use to say, "Never mind....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top