Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6687959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:20:57+00:00 2026-05-26T05:20:57+00:00

I am working on an application system in CakePHP. Each application contains the address

  • 0

I am working on an application system in CakePHP. Each application contains the address and a (UK only) postcode of the applicant.

The client wants to be able to assign “postcode areas” to a given member of their team.
Unfortunately the postcode area varies in format and length – examples: TA, TQ1, S60, BS22, TA6 4EJ

The user wants to be able to specify entire areas, or more specific areas on a per user basis if required.
schema

I need to be able to take each prefix and compare it to the postcode for each application, and return any matches.


User Ross manages applications with postcode beginning with: BQ. BS and S60

User Dave manages applications with full postcodes: BS22 4JL and TA6 7EJ


I figured that the best way would be to have a table full of user-defined postcode prefixes:

   id  |  prefix
    1  |      TQ
    2  |      TL
    3  |     S50
    4  |     S55
    5  | TA6 4EJ

Each user is assigned a postcode area to manage.

I’m thinking if I can compare each application postcode to each prefix, I can retrieve all applications in a given postcode area, then look up the user that this belongs.

id | postcode
1  |  tq33 abc
2  |  TL5  8HA
3  |  s50 11l

The postcode data isn’t in any standard/regular format unfortunately; so this might get tricky.
It sounds like I need to JOIN the prefix on to the postcode; but as there’s no key I don’t think that’s possible.

There’s no direct association between prefix and postcode. Feel like I’m missing something fundamental

Any pointers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:20:57+00:00Added an answer on May 26, 2026 at 5:20 am

    try:

    SELECT users.name, app.* from applications app, users, postcodes where app.postcode LIKE CONCAT(postcodes.prefix,'%') AND postcodes.user_id = users.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an application that installs a system wide keyboard hook. I
I am working on a simple chat application using a System.Windows.Forms.WebBrowser Control to display
We are working on designing an application that is typically OLTP (think: purchasing system).
I'm working on a web application that submits tasks to a master/worker system that
I am working on a wpf application. Here I need to use System.Windows.Forms.FolderBrowserDialog in
My problem is that memcache logic inside my cakePHP application is not working on
I am working on a C# .NET application with System.Windows.Forms.WebBrowser. IE is not responding
I'm working on an application for my distributed system laboratory course. I have a
I'm trying to get a console application working with the SignalR .Net Client but
I'm working on an application for one of our departments that contains medical data.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.