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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:05:20+00:00 2026-06-03T03:05:20+00:00

Lets say I have a field. Lets call it Barcode1. Right now all Barcodes1

  • 0

Lets say I have a field. Lets call it Barcode1. Right now all Barcodes1 are 22 characters with each character is an integer.
Suppose there is a second field Barcode2. Both of these are varchar(22)

My condition in plain english terms is:
Barcode1 is identical to barcode2 except in digits 7,8 where for barcode2, digits 7 and 8 are the same thing in barcode1 plus 20

so

001214**54**54545654521523
549462**74**48634842135782

I also would like the negation of the where clause where rows that do NOT match the condition are returned.

Thank you.

  • 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-03T03:05:22+00:00Added an answer on June 3, 2026 at 3:05 am

    You’ll have to break that barcode up using string operations, something like:

    WHERE
        substring(barcode1, 0, 6) = substring(barcode2, 0, 6) AND
        substring(barcode1, 9, 2) = substring(barcode2, 0, 9) AND
        etc...
    

    And since you’ll be doing these comparisons on function results, indexes aren’t going to be used. If this is a frequent operation, you’d be better off splitting up the barcode strings into individual fields so you can compare the individual chunks as fully separate indexable fields.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

lets say I have a table call payment that have a field call thing_id
I my index lets say I have field field named full_name. I'm doing following
Let's say I've got a database table with an integer field - call it
Let's say I have a record class Person with an integer field awesomeness .
Let's say I have a Customer table which has a PrimaryContactId field and a
Let's say I have an Order table which has a FirstSalesPersonId field and a
I have a field in a table which contains bitwise flags. Let's say for
Lets say have this immutable record type: public class Record { public Record(int x,
Lets say I have this code: <?php class hello { var $greeting = hello;
Lets say I have a loop in Bash: for foo in `some-command` do do-something

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.