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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:36:07+00:00 2026-06-06T07:36:07+00:00

Searching for values that uses the same value Example SELECT Name, UnitPrice, Quantity, Color

  • 0

Searching for values that uses the same value

Example

SELECT Name, UnitPrice, Quantity, Color
FROM Product
WHERE Name Like '2' OR UnitPrice Like '2' OR Quantity LIKE '2' OR  Color LIKE '2'

is there a way to shorten the sentence so that i do not need to repeat Variable LIKE ‘value’?

  • 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-06T07:36:09+00:00Added an answer on June 6, 2026 at 7:36 am

    LIKE without wildcards is =

    SELECT Name, UnitPrice, Quantity, Color
    FROM Product
    WHERE '2' IN (Name, UnitPrice, Quantity, Color)
    

    This expands out to a series of OR conditions
    Note that the string '2' will be CAST as needed after OR expansion

    If you do require wild cards and LIKE, you’d have to use a series of OR statements.

    Finally, this won’t scale performance-wise. With good indexing, (eg one per column and other 2 as INCLUDE columns) then this would probably be better written as separate queries with UNION between them

    Edit, for clarity

    OP wants to use wildcards. Therefore my IN suggestion will not work. So you have to do this

    WHERE
        Name Like '%2%' OR
        UnitPrice Like '%2%' OR 
        Quantity LIKE '%2%' OR
        Color LIKE '%2%'
    

    Because of the leading wildcard, there is no point adding indexes. So my text above about indexes+includes is irrelevant

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

Sidebar

Related Questions

I am maintaining a Python script that uses xlrd to retrieve values from Excel
I'm still searching solution for getting values from dynamic created object. Follwing code generates
I have a file and searching mutiple value i.e I need to search {Name,Class}
Searching from google.com, like www.abc.com Search Result Rank the pages like Title..... Description... www.abc.com
I would like to build a Django app that allows searching for a movie
Searching a Python dictionary based on the value first, to get a key output
How to get the value on a specific row by searching? i.e., I have
Searching here I found that this question was already asked , but I think
I have a UITableView that was created from data coming from a mutable array.
I'm writing a program in python that uses genetic techniques to optimize expressions. Constructing

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.