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

  • SEARCH
  • Home
  • 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 8668791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:18:07+00:00 2026-06-12T18:18:07+00:00

I have a field area in table property , in this field records are

  • 0

I have a field area in table property, in this field records are saved in 1-0-3-4, 0-4-2-0 and so on. In each record 1st represent the Highest denomination of area, second represent the second highest, third – the third highest and last, i.e. fourth denote the lowest denomination of an area. The format x-x-x-x is how the area of a land or property is denoted in our country.

Searching above field for exact match is not a problem, but what if I have to show results with nearest match as well. Like , 1-0-3-3, 1-0-4-4,1-0-3-5 are the nearest match with 1-0-3-4

Is it possible?

Thanks

  • 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-06-12T18:18:08+00:00Added an answer on June 12, 2026 at 6:18 pm

    It’s possible, but messy. It would help if you could normalize the “area” field into individual columns – it would make the solution neater and much faster!

    An example implementation might be:

    select area, 1 as match_quality
    from property
    where area = '1-0-3-4'
    union
    select area, 2 as match_quality
    from property
    where area like '1-0-3-_' 
    union
    select area, 3 as match_quality
    from property
    where area like '1-0-_-4' 
    

    This assumes that the distance between areas is the same for any of the values in a given column. If that’s not the case, you can refine it by retrieving the code (through SUBSTRING) and doing whatever arithmetic on it that you need.

    If you convert area to individual columns, this becomes easier and nicer, as well as faster (the last query in the above union will be slow, because it can’t use the index all that efficiently).

    For instance:

    select *, 1 as match_quality
    from property
    where area1 = 1
    and area2 = 0
    and area3 = 3
    and area4 = 4
    union 
    select *, 2 as match_quality
    from property
    where area 1 = 1
    and area 2 = 0
    and area 4 = 4
    union
    select *, 3 as match_quality
    from property
    where area 1 = 1
    and area2 = 0
    and area4 = 4
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table called location with a field area. This field can contain various
I have a table called location with a field area . This field can
I have some text area field in my grails application. I got the following
I have a text input field like text box or text area. I want
I have field like a_b_c_d I want as the output a b c_d, this
in my jqgrid i have field in a table which represents the id and
I have a MySQL table, with the field ('ad_id'). I store variables in different
i have this problem: i have a form with textarea field, and on a
I've got three table where I've got field - area . So I decided
I have a table of venue records which are being displayed on the index

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.