Urgent help request on query !!!! Please

dxp

Registered User.
Local time
Yesterday, 18:05
Joined
Jun 5, 2006
Messages
62
Hi All,
Can anyone help me count postcode instances. I have a query that looks at my customers table (tbl_Customer_Details) post code field (PostCode), at the moment I have got it to strip out the right side of the postcode leaving me the left district side eg. HG12 8EN becomes HG12. I would then like to count how many times each postcode instance occurs so I can create a report on the result so I can track which district the customers are coming from. I hope this explains the problem. Any help would be much appreciated as I promised the Boss this for tomorrow....:confused:

this is my SQL so far, it strips out the left of the postcode:

SELECT tbl_Customer_Details.PostCode, Left([Postcode],4) AS Code
FROM tbl_Customer_Details
GROUP BY tbl_Customer_Details.PostCode;


What do I add to do the count?
 
add the count to the primary key.
 
Not sure what you mean KeithG, can you elaborate or show me please
thank you for your quick reply
 
SELECT Left([Postcode],4) AS Code, Count([FieldName]) As CountPostCodes
FROM tbl_Customer_Details
GROUP BY Left(tbl_Customer_Details.PostCode,4);

[FieldName]= Name of the field the uniquely identifies your records
 
I can't thank you enough KeithG, it worked perfectly. Again Thanks very very much. What a wonderfull place this is.:D
 
What I find utterly amazing is how people seem to make things look so easy. How on earth do you learn this stuff? I am fairly new to database concepts and am having to fumble my way around using this forum and reading books the size of the bible. The db I am working on has taken me 7 months so far and I know it would not stand up to your scrutany.....
 

Users who are viewing this thread

Back
Top Bottom