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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:48:40+00:00 2026-06-03T20:48:40+00:00

I have to generate a single sql query, which retrieves two columns from two

  • 0

I have to generate a single sql query, which retrieves two columns from two tables.
In where clause the id is 1,2,3,4 and 5.
How to form a single query with the above specified condition.
I need only sql query but not cursor or functions concept.
Eg;

select column 1, column2 from table1, table2 where id=1  
select column 1, column2 from table1, table2 where id=2  
select column 1, column2 from table1, table2 where id=3  
select column 1, column2 from table1, table2 where id=4  

How to make these multiple queries into a single query???
Thanks in Advance.

  • 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-03T20:48:41+00:00Added an answer on June 3, 2026 at 8:48 pm

    make use of wher in clause will resolve your issue easily …

    The IN Operator

    The IN operator allows you to specify multiple values in a WHERE clause.

    select column 1, column2 from table1, table2 where id in (1,2,3,4,5)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multi-table SQL query. My need is: The query should I generate
We use calculated columns in a few SQL Server 2005 tables which always return
I have a questions related to SQL (teradata in particular). I have to generate
I have a method to Generate Expression By Clause as below: internal static Expression<Func<TModel,
I have this Maven task to generate Java classes from an XSD file using
I have an application that needs to join tables from multiple databases into a
I have a strange query to perform from a website. I have sets of
I have the output of SQL Servers Tasks -> Generate Scripts... for all the
I have a table in SQL Server 2005 which contains some changelog data for
I need help writing a T-SQL query that will generate 52 rows of data

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.