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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:31:08+00:00 2026-05-23T03:31:08+00:00

lets say I have a table called table1 and it’s corresponding columns are col1,

  • 0

lets say I have a table called table1 and it’s corresponding columns are col1, col2, col3 and col4 for example.

what will be the equivalent thing of doing:

-- note that the following query will not work
SELECT * 
  FROM table1 
 WHERE col1, col2 IN (SELECT col1, col2 
                        FROM table1 
                       WHERE col3 < 4)

Do I have to merge col1 and col2 in my database to make this work? If I merge col1 and col2 into col1_2 then I will be able to make the above query work by writing:

SELECT * 
  FROM table1 
 WHERE col1_2 IN (SELECT col1_2 
                    FROM table1 
                   WHERE col3 < 4)

The IN clause works fine when using one column. it will be nice if I could use it with several columns without having to modify the database.

  • 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-23T03:31:08+00:00Added an answer on May 23, 2026 at 3:31 am
    SELECT * from table1 t1, table1 t2
    where t1.col1=t2.col1 and t1.COl2=t2.Col2 and t1.col3<4
    

    try this one

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

Sidebar

Related Questions

Lets say I have one table called REVIEWS This table has Reviews that customers
Lets say I have a table in MySQL called articles, that has a column
Lets say I have a database table called Scrape possibly setup like: UserID (int)
For example, lets say I have an entity called user and an entity called
Lets say I have a table called Projects in my SQL server. My dbml
Lets say I have a table called Employees , and each employee has a
Hoping someone can help me out with this. Lets say I have a table
Lets say I have a table named my_table with primary_key table_pk and with three
I have a table called Cat , and an PHP class called Cat .
Lets say we have two databases, one named db1, the other one named db2.

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.