Another SQL SELECT question

Mondeo

Well-known member
Joined
Nov 10, 2006
Messages
128
Location
Sunny Lancashire
I have this table

Postcode Town County

BB9 4TL Burnley Lancashire
BB9 4TP Burnley Lancashire
BB8 4TJ Burnley Lancashire
PR8 4YU Preston Lancashire
PR4 3TY Preston Lancashire
FY4 4TY Blackpool Lancashire
FY7 9TY Blackpool Lancashire

Theres a lot more, its over a million rows but what I want to end up with is unique town/county pairs with either the first postcode, or any postcode relating to that pair. So my results should look like:

Postcode Town County
BB9 3TL Burnley Lancashire
PR8 4YU Preston Lancashire
FY4 4TY Blackpool Lancashire

Thanks
 
GROUP BY clause

Something like this should work:

Code:
SELECT ... FROM ... GROUP BY Town

In my experience this would return one record per Town (usually the first).

Good luck :)
 
Back
Top