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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:59:15+00:00 2026-05-31T14:59:15+00:00

I have a database and some of the columns contain things like CA, GB

  • 0

I have a database and some of the columns contain things like CA, GB etc, although some contain multiple country codes like

US+GB+CA+AU

I’m just wondering what kind of query I would do that would return that row when I’m searching for just CA or just GB, and no necessarily the whole package US+GB+CA+AU

Encase that’s a little confusing, basically I just need to return that row based on a search for just CA or just GB etc.

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-05-31T14:59:17+00:00Added an answer on May 31, 2026 at 2:59 pm

    Use FIND_IN_SET(), but you’ll first need to replace + with , since it expects a comma-separated string. Even without the
    REPLACE(), this is will not make use of any index on the countrycodes column.

    SELECT * FROM tbl 
    WHERE FIND_IN_SET('AU', REPLACE(countrycodes, '+', ',')) > 0
    

    The proper long term solution, however, is to change your database structure to normalize these country codes into a table that contains only two columns – a country code, and the id of the associated row from the table you’re attempting to query now. You can then index the column appropriately to improve performance (possibly drastically improve it).

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

Sidebar

Related Questions

i have one database, and it contains some columns. My requirement is that how
I have an Ultrawingrid to which I am binding some columns from the database.
I have a database that has around 10k records and some of them contain
I have some columns in my database, mostly varchar 255s. They are only accessed
I have some files stored in a database blob column in Oracle 9. I
I am into some problems atm, that is, I have a database of some
I have a database table with some rows that I want to fetch using
I have an existing database containing some pictures in blob fields. For a web
so in my database some rows have NULL values, and when I select *
I have several Delphi programs that maintain connections to a database (some Oracle, some

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.