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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:46:36+00:00 2026-06-14T03:46:36+00:00

Given this query: SELECT a, b FROM c WHERE a IN (‘v1’, ‘v2’, ‘v3’);

  • 0

Given this query:

SELECT a, b FROM c WHERE a IN ('v1', 'v2', 'v3');

If table c had values for v1 and v2 but not v3, I’d get a result set of 2 rows. Is there a way I can perform the same query (or one that yields the same outcome) while getting a row for every target?

In this case, I’d like to receive 3 rows, 2 with the values for ‘v1’ and ‘v2’ and one with a NULL.

  • 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-14T03:46:37+00:00Added an answer on June 14, 2026 at 3:46 am

    Not sure if this will work on your particular RDBMS, but here’s how I would approach it:

    select x.a, c.b
    from (
      select 'v1' as a union all
      select 'v2' as a union all
      select 'v3' as a
    ) x
    left outer join c on c.a = x.a
    

    Create a temporary table and use it to left-join in your desired table.

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

Sidebar

Related Questions

Given this table: and this query: SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, IS_NULLABLE FROM
I am trying to select data from a MySQL table, but I get one
I have a table with a Timestamp(6) column called START_DATE. Given this query: SELECT
I have this query: select distinct id,name from table1 For a given ID, the
Consider this query: SELECT F1,F2 FROM TABLE GROUP BY F1 Selecting F1 is valid,
I need query to get data between two days.I tried with this.But it gives
I have this query SELECT * FROM functions WHERE (models_mask & 1 > 0)
In a SQL Server 2005 database I'm working on this query: select * from
Considering this MySQL query: SELECT someColumns FROM someTable WHERE someColumn IN ( value1, value2,
I retrieve data from database using this query: SELECT * FROM tickets_departement_groups WHERE group_id

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.