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 995255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:41:42+00:00 2026-05-16T06:41:42+00:00

Problem I’m joining two tables on postcode. I only have the data for the

  • 0

Problem

I’m joining two tables on postcode. I only have the data for the first half. The problem is where I have CM16 6BY in my user table and it matches CM1 and CM16 in my postcode table. Obviously I only want it to match with CM16 but I cannot write a query to do so. I’m sure I am doing something stupid but I am stuck. Can anyone help? Many thanks.

Query

SELECT user.postcode, postcode.postcode
FROM user
INNER JOIN postcode ON user.postcode LIKE CONCAT( postcode.postcode,  "%" ) 
WHERE user.postcode LIKE  "CM%"
LIMIT 0 , 30

Results

postcode    postcode
CM16 6BY    CM1
CM16 6BY    CM16
CM3 4XB CM3
CM9 6SW CM9
CM24 8JD    CM2
CM24 8JD    CM24
CM3 3EP CM3
CM1 3ES CM1
CM2 5AP CM2
CM22 6AZ    CM2
CM22 6AZ    CM22
CM17 9LH    CM1
CM17 9LH    CM17
CM2 7ER CM2
CM159ES CM1
CM159ES CM15
CM15 0NW    CM1
CM15 0NW    CM15
CM3 6XA CM3
CM14 4BT    CM1
CM14 4BT    CM14
CM9 4TB CM9
CM1 1HZ CM1
CM22 6DG    CM2
CM22 6DG    CM22
CM15 8QY    CM1
CM15 8QY    CM15
CM8 3HR CM8
CM1 1GS CM1
CM5 0BB CM5
  • 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-16T06:41:42+00:00Added an answer on May 16, 2026 at 6:41 am

    try this out

    SELECT user.postcode, max(postcode.postcode) as postcode
    FROM user
    INNER JOIN postcode ON user.postcode LIKE CONCAT( postcode.postcode,  "%" ) 
    WHERE user.postcode LIKE  "CM%"
    GROUP BY user.postcode
    LIMIT 0 , 30
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 506k
  • Answers 506k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try calling SetErrorMode( SEM_FAILCRITICALERRORS) to prevent the error messageboxes from… May 16, 2026 at 3:52 pm
  • Editorial Team
    Editorial Team added an answer http://maven.apache.org/general.html#skip-test Just specify -Dmaven.test.skip=true when you invoke a target and… May 16, 2026 at 3:52 pm
  • Editorial Team
    Editorial Team added an answer Yes, you need to specify the classpath using the -classpath… May 16, 2026 at 3:52 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Problem: I have two spreadsheets that each serve different purposes but contain one particular
Problem: I have an address field from an Access database which has been converted
Problem: We have to read from a proprietary binary file at work. It changes
My problem is that I have a site which has requires a dedicated page
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
I have a French site that I want to parse, but am running into
Problem (simplified to make things clearer): 1. there is one statically-linked static.lib that has
Problem: Ajax suggest-search on [ n ] ingredients in recipes. That is: match recipes
Problem: Given a list of strings, find the substring which, if subtracted from the

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.