Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

GROUP BY clause

 

Something like this should work:

 

SELECT ... FROM ... GROUP BY Town

 

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

 

Good luck :)

Never trouble another for what you can do for yourself.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...