Home
Classic
Harley
Yamaha
Suzuki
Ducati
Triumph
Honda
Kawasaki
Aprilia
Moto Guzzi
BMW
Buell
Morini
Royal Enfield
Racing
Tarmac
Track
Motocross
Trials
Mechanics
Chain
Oil
Battery
Tank
Carb
Horn
Lights
Brakes
Clutch
Cylinder
Gears
Wheels
Tyres
Chassis
Exhaust
Suspension
Misc

OT: SQL SELECT required



I have a SQL query that I'd like to generate...

I have a field in a table that has various entries. I want to show top two
entries and the total count from the table for the records with that entry.

i.e. a distinct query that shows the total number of records with each
value.

Any ideas?
Select Top 2 FieldName, count(*) from tblName
group by FieldName
order by Count(*)

off the top of my head.
Whoops - left off something important

Select Top 2 FieldName, count(*) from tblName
group by FieldName
order by Count(*) desc
Spot on cheers...