I need some help with sql.
My table has 4 fields: A, B, C, D
I need my output to be grouped by A, B, C and a value of D which occurs
maximum number of times (if more than one value occurs same number of
times, any of those values is fine).
So if my records are:
A1, B1, C1, D1
A1, B1, C1, D2
A1, B1, C1, D2
A1, B1, C1, D3
A1, B1, C1, D4
A1, B1, C1, D4
A2, B1, C2, D1
My output should be:
A1, B1, C1, D2 or it can be A1, B1, C1, D4
A2, B1, C2, D1

This would be a one time process on about a million records so performance
is not an issue and it need not be a single sql.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2021 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.