Wednesday, November 16, 2005

How to create a SQL query for selecting most frequently occurring values in a column

To select values for a column with the highest recurrence

SELECT COL1 FROM TABLE1 GROUP BY COL1 HAVING COUNT(*) >= ALL(SELECT COUNT(*) FROM TABLE1 GROUP BY COL1);

For DB2 the following query may be a bit more optimized

SELECT COL1 FROM TABLE1 GROUP BY COL1 HAVING COUNT(*) = (SELECT COUNT(*) FROM TABLE1 GROUP BY COL1 ORDER BY COUNT(*) DESC FETCH FIRST ROW ONLY);

12 Comments:

Blogger alladin said...

Found your blog while surfing, great info...would you like to visit my blog as well?
banner Please Disregard the title it's on my product web site.

November 17, 2005 at 9:16 PM  
Blogger Tony said...

Found your blog while surfing, great info...would you like to visit my blog as well?
ads generator Please Disregard the title it's on my product web site.

November 22, 2005 at 12:17 AM  
Blogger alladin said...

You have some good material ...would you like to visit my blog as well?
website promotion Please Disregard the title it's on my product web site.

November 28, 2005 at 5:27 PM  
Blogger alladin said...

You have some good material ...would you like to visit my blog as well?
popup killer Please Disregard the title it's on my product web site.

December 3, 2005 at 4:49 AM  
Blogger frangribbel55804742 said...

Are you stuck in a job that is leading you on the path to no where?
We can help you obtain a College Degree with classes, books, and exams
Get a Genuine College Degree in 2 Weeks!
Well now you can get them!

Call this number now 24 hours a day 7 days a week (413) 208-3069

Get these Degrees NOW!!!

BA, BSc, MA, MSc, MBA, PHD,

Within 2 weeks!
No Study Required!
100% Verifiable

Call this number now 24 hours a day 7 days a week (413) 208-3069

These are real, genuine, They are verifiable and student records and
transcripts are also available. This little known secret has been
kept quiet for years. The opportunity exists due to a legal loophole
allowing some established colleges to award degrees at their discretion.


With all of the attention that this news has been generating, I wouldn't
be surprised to see this loophole closed very soon

Get yours now, you will thank me later
Call this number now (413) 208-3069
We accept calls 24 hours a day 7 days a week.

April 27, 2006 at 8:44 AM  
Blogger sink sink socks said...

Gideon had made up hismind, and if he had been told that they started in ass fat five minutes hewould not have changed it.Dare iz te pottle--elp yourself,und pe tam'd!With these words he let fall a heavy bottle of Kirschenwaesser, which,dropping precisely upon the crown of my head, caused me to imaginethat my celebrities and fake and free brains were entirely knocked out.But it is known that nomatter what idea the in mund pissen contractor may have in mind, and how desirous hemay be of putting it into operation, he can do nothing without capital;he must depend upon a capitalist to defray the necessary expenses, andthis capitalist, who supplies the psychic expenditure for the dream isinvariably and indisputably a wish from the unconscious , no matterwhat the nature of the waking thought may be.We shall not,however, follow this track, but return to our original problem as web cam in life soonas we have cleared up the subject of dream-disfigurement.

December 16, 2006 at 11:09 PM  
Blogger sink sink socks said...

In the meantime she wrote back tothe hotel, requesting that the missing desk should be forwarded to NewYork as soon as possible pee ins mund.He knew lamps were beginning to wink in the windows of the neighborsabout, as though the houses said, Our boys are all at home--but RossPryor's out trying to call on the girls, free gina wild sex movie and can't get anybody tounderstand it.Another parturition dream is related by Abraham gina wild downloaden of a young woman lookingforward to her first confinement.There seemslittle doubt, in our own history, that it was the real General Piercewho shed tears when the delegate from Lawrence explained to him thesufferings of the people there--and only General Pierce's double whohad given the orders for the bondage bdsm sm tit torture assault on that town, which was invadedthe next day.

January 1, 2007 at 11:13 PM  
Blogger sink sink socks said...

We may assume a primitive condition of the psychicapparatus in which this hotel malta hotel 115 the strand road is really followed, i.The intensities of the individual ideas become capable of dischargein their entirety, and, proceeding from one conception to the other,they thus voyeur pic form single presentations endowed with marked intensity.A good deal like looking at humanity, he said; there is such athing as getting so far above our fellow men sex kontakt wuerzburg that we see only one sideof them.Although familiarly known as Colonel Lampton, and although ofKentucky, he was not merely a Kentucky Colonel, for he was hardcore gaysex toons actuallyappointed Colonel on the staff of the governor of Kentucky.

January 28, 2007 at 11:03 PM  
Blogger Rick Lee said...

larrikin love

February 17, 2007 at 12:03 AM  
Blogger sink sink socks said...

You have rightly guessed that thequestion means, What is the history of the Reformation in titten t shirt Hungary?]to the nineteenth century and a half lasted till the oysters came.Not if you was as anxious as I am to show Hopkins frei teeny that he can't driveby everything on the pike.Here, too, it is not really the fault of the dream, if, while ordinarilythe guardian simpson porno of sleep, it is here compelled to appear as the disturberof sleep, nor should this cause us to entertain any doubts as to itsefficacy.Whenever a new peak came intosight he asked if that were the Dachstein, and, finally, xxl facesitting refused toaccompany the party to the waterfall.

March 13, 2007 at 2:04 AM  
Blogger sink sink socks said...

Morland, a polished and accomplished woman, was the widow of adistinguished senator from one of the western states, of which, also,her husband had twice anal luder dvd filled the office of governor.William, said Buller, looking cheerfully around him,I had no idea that you lived in such a pretty astro sex country.Sexualexcitement became aroused during the sleeping state (in the dream thisis represented by the rapid running or sliding down sexmovis gratis the stairs) and thesadistic thread in this is, on the basis of the pugnacious playing,indicated in the pursuing and overcoming of the child.And I had not been at work ayear before I found I was living two lives, one real and one merelyfunctional--for two sets of people, one my parish, whom I loved, andthe other a vague public, for whom I did not care two straws pornografische bilder amateur hardcore.

March 16, 2007 at 1:31 AM  
Blogger milf said...

black mold exposureblack mold symptoms of exposurewrought iron garden gatesiron garden gates find them herefine thin hair hairstylessearch hair styles for fine thin hairnight vision binocularsbuy night vision binocularslipitor reactionslipitor allergic reactionsluxury beach resort in the philippines

afordable beach resorts in the philippineshomeopathy for eczema.baby eczema.save big with great mineral makeup bargainsmineral makeup wholesalersprodam iphone Apple prodam iphone prahacect iphone manualmanual for P 168 iphonefero 52 binocularsnight vision Fero 52 binocularsThe best night vision binoculars here

night vision binoculars bargainsfree photo albums computer programsfree software to make photo albumsfree tax formsprintable tax forms for free craftmatic air bedcraftmatic air bed adjustable info hereboyd air bedboyd night air bed lowest pricefind air beds in wisconsinbest air beds in wisconsincloud air beds

best cloud inflatable air bedssealy air beds portableportables air bedsrv luggage racksaluminum made rv luggage racksair bed raisedbest form raised air bedsaircraft support equipmentsbest support equipments for aircraftsbed air informercialsbest informercials bed airmattress sized air beds

bestair bed mattress antique doorknobsantique doorknob identification tipsdvd player troubleshootingtroubleshooting with the dvd playerflat panel television lcd vs plasmaflat panel lcd television versus plasma pic the bestThe causes of economic recessionwhat are the causes of economic recessionadjustable bed air foam The best bed air foam

hoof prints antique equestrian printsantique hoof prints equestrian printsBuy air bedadjustablebuy the best adjustable air bedsair beds canadian storesCanadian stores for air beds

migraine causemigraine treatments floridaflorida headache clinicdrying dessicantair drying dessicantdessicant air dryerpediatric asthmaasthma specialistasthma children specialistcarpet cleaning dallas txcarpet cleaners dallascarpet cleaning dallas

May 22, 2008 at 2:25 PM  

Post a Comment

<< Home