473,396 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Postcode Letters count query

I have to to create a query that produces a count by the first letter(s) of the postcode where the count is greater than 100. (In Bitish postcodes)

For e.g.
First Letter(s) of Post code Count
B 300
CM 260
CR 237
CV 288

NOT
B1 200
B2 150
CM 260

Any help would be appreciated.

Thanks

Addy
Aug 16 '07 #1
10 3111
Rabbit
12,516 Expert Mod 8TB
I don't know British postal codes so you'll have to help me out here.
First thing you need to do is seperate the letters from the numbers and then do the count. How many letters can there be in the postal code?
Aug 16 '07 #2
missinglinq
3,532 Expert 2GB
And are there always spaces between letters and numbers?
Aug 16 '07 #3
Rabbit
12,516 Expert Mod 8TB
Well I finally decided to just look it up so...

Expand|Select|Wrap|Line Numbers
  1. SELECT iif(IsNumeric(Mid(Postcode,2,1)), Left(Postcode,1), Left(Postcode,2)) AS Area, Count(Postcode) AS CountOfArea
  2. FROM tbl_Postcodes
  3. GROUP BY iif(IsNumeric(Mid(Postcode,2,1)), Left(Postcode,1), Left(Postcode,2));
  4.  
Aug 16 '07 #4
Hi

Thanks for the reply. Post code could be of the form:

B19 2TT
B17 3SW
SW19 0XL
KT19 0NR
BW1 15TS

I need to count the occurance of first letter or letters before the space(There is always a separation in the UK postcodes). For example if I have fifty thousand postcodes, I need to count how many were of the form B's, BW's or SW's, KT's or K's. I need to try this in access table where there is only one field called Post Code. I am not very good at queries in Access, that is why I have posted it here.

Thanks
Addy
Aug 17 '07 #5
Stwange
126 Expert 100+
Hi

Thanks for the reply. Post code could be of the form:

B19 2TT
B17 3SW
SW19 0XL
KT19 0NR
BW1 15TS

I need to count the occurance of first letter or letters before the space(There is always a separation in the UK postcodes). For example if I have fifty thousand postcodes, I need to count how many were of the form B's, BW's or SW's, KT's or K's. I need to try this in access table where there is only one field called Post Code. I am not very good at queries in Access, that is why I have posted it here.

Thanks
Addy
You can also have BB4 4BB (ie just two numbers in between.

Pretty much L{L}#{#}_#LL
Aug 17 '07 #6
Rabbit
12,516 Expert Mod 8TB
Hi

Thanks for the reply. Post code could be of the form:

B19 2TT
B17 3SW
SW19 0XL
KT19 0NR
BW1 15TS

I need to count the occurance of first letter or letters before the space(There is always a separation in the UK postcodes). For example if I have fifty thousand postcodes, I need to count how many were of the form B's, BW's or SW's, KT's or K's. I need to try this in access table where there is only one field called Post Code. I am not very good at queries in Access, that is why I have posted it here.

Thanks
Addy
... And that's exactly what I've given you in post #4, is there a problem with it?
Aug 17 '07 #7
Thanks for the query, it is understandable however I do not know how to implement it as I am quite new to Access. Please help me understand in what form should I apply this query

Thanks again
Aug 29 '07 #8
I have tried select query and when I ran it I got the following result for BW

Area Count
BW 9

which is not correct. I have 2 postcodes starting with BW in my table. Please check the query.

Thanks
Addy
Aug 29 '07 #9
I am sorry but the Postcode field name I selected initially was incorrect(Post_Code) and I have changed it to Postcode. It is working now.

Thanks a lot

Addy
Aug 29 '07 #10
Rabbit
12,516 Expert Mod 8TB
Not a problem, good luck.
Aug 29 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: AJ | last post by:
Hi All Just a quickie. A form element for a search will contain either a town or a post code. Is there any way we can check the input to see if the element contains a number (in which case it...
5
by: Lapchien | last post by:
I have a field for a postcode. I'd like another field to auto contain an 'area' number, based on the first part (only) of the postcode. For example, if a postcode LS4 4DJ was entered, another...
3
by: dd_bdlm | last post by:
I am trying to isolate the identifying area codes from postcodes and want to extract the first one or two letters from each postcode. I have created a query that uses: SmallPostCode:...
6
by: Julian | last post by:
Hi, I am a very beginner in databases. I created a database table in Access 2003 and OOo 2.03 that includes name, address, postcode, phone numbers etc of our customers. I would like to sort...
3
by: mark | last post by:
I have a table of UK companies whose records I want to filter using a map of postcode regions. For the benfit of people outside the UK, our postcodes are a pain to work with because they are not...
12
by: xhe | last post by:
I am now developing a website which needs Canadian PostCode Database. I can certainly buy one, but that will cost my hundered of $$, and my website is only for education purpose, it won't make...
5
by: billynastie2007 | last post by:
Hi i am writing a balloon race site and i am having problems with some functions to calculate the distance the balloon travels firstly i am reading my info from the database using the fetch assoc...
0
by: Pinna | last post by:
Hiya, I am trying to select based on a range on postcode on a table. The field POSTCODE is a varchar2(8). The problem is when refinng on 'where postcode between 'PE1' and 'PE29'', because this is...
1
by: dominicowen | last post by:
Hi, I have a customer database in Access 2003 with customers postcodes. What I want to do is type in a postcode on access and it will link the postcode on to googlemaps without having to type...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.