× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



So why didn't " select usrinusr, usrinjob, usrinnbr, min(usrinlvl), min(usrinpgm), min(usrintstmp) from mgpll/usrinpf1 group by usrinusr, usrinjob, usrinnbr order by usrinnbr"

Work for you?

-----Original Message-----
From: Gqcy [mailto:gmufasa01@xxxxxxxxx]
Sent: Wednesday, February 06, 2013 2:43 PM
To: midrange-l@xxxxxxxxxxxx
Subject: sql - group by clause, aggregate returning first record values for rest of fields.

I have a file with 6 fields, I want to aggregate by the first three fields (jobname, user, jobnumber), I want to return the "first values found" for the rest of the fields in the file.
I can get min() to kinda work, but that is field dependent.


select usrinusr, usrinjob, usrinnbr, usrinlvl, usrinpgm, usrintstmp from mgpll/usrinpf1 group by usrinusr, usrinjob, usrinnbr order by usrinnbr

I want to return the values in the first record returned for the group record by usrinusr, usrinjob, usrinnbr...



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.