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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:59:12+00:00 2026-06-12T23:59:12+00:00

Apologies for question title, if anyone can explain it better please do edit. I

  • 0

Apologies for question title, if anyone can explain it better please do edit.
I have a MySQL select statement (which I am running through Perl dbi) like below:

select skills from my_table where (skills like '%maths%' or skills like '%english%');

This will run, but it chooses either skills like ‘maths’ OR skills like ‘english’.
I would like to have it so it definitely finds ‘maths’, and maybe finds ‘english’ if that makes sense.

I think of it kind of like when you have and, where it only returns results with those elements. So if I had done:

select skills from my_table where (skills like '%maths%' and skills like '%english%');

it would have returned results with BOTH skills.

So what I want is a combination of both sqls if that is possible, with the ‘maths’ being a definite find, and the ‘english’ being optional. I hope I have explained this properly… any help appreciated!

Edit: okay, maybe I do need to clarify… if there is an option for ‘english’ I want it to be found, but if there isn’t I want it to still pick up options for ‘maths’, but if there are no ‘maths’ options, then I want it to return nothing. So it is not just one or the other.

  • 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-12T23:59:15+00:00Added an answer on June 12, 2026 at 11:59 pm

    This will return the keyField for all rows with maths skills, as well as an additional column to show whether or not they also have english skills.

    select   keyField,  
            'Maths' mathsSkill,
            CASE WHEN skills LIKE '%english%' THEN 'English' else 'No English' END englishSkill
    from    my_table 
    where   skills like '%maths%'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apologies in advance for the question title, I can't think of a better way
Apologies for the poor question title. I have two tables, jobs and Persons-Jobs. Jobs
[Apologies if my question title does not accurately describe my problem- if you can
First of all, my apologies for the title of this question, I don't have
I could not think of a better way to title this question. my apologies
First: apologies for the question title, I don't actually know what the problem is
First of all apologies for the poor unclear question title, it is quite a
(Apologies for the title of this question - I wasn't overly sure how to
Straightforward question - apologies if it is a duplicate, but I can't find the
I am not sure if I can post this sort of question (apologies in

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.