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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:04:23+00:00 2026-06-17T21:04:23+00:00

I have this table Column1 Column2 1 value1 2 value2 3 value3 4 value4

  • 0

I have this table

Column1  Column2
1        value1
2        value2
3        value3
4        value4

Using this statement:

SELECT * FROM table WHERE column2='value2'

Only displays this:

Column1  Column2
2        value2

I want to display this:

Column1  Column2
1
2        value2
3
4  

How?

  • 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-17T21:04:24+00:00Added an answer on June 17, 2026 at 9:04 pm

    Well, your WHERE clause is saying “show me the rows where column2 = value2” – so, as written, it can’t possibly include any rows where column2 has any other value, because they’ve been filtered out.

    Here’s one way to accomplish what you’re looking for, using a CASE expression (and no WHERE clause):

    SELECT column1, column2 = CASE 
      WHEN column2 = 'value2' THEN 'value2'
      ELSE NULL
    END
    FROM dbo.table;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table like this: ID Name Column1 Column2 Column3 1 ABC 202.2
I have table with two columns (varchar from, varchar to). This table represents connections
I have a file that has columns that look like this: Column1,Column2,Column3,Column4,Column5,Column6 1,2,3,4,5,6 1,2,3,4,5,6
I'm using EF (4.4) and have a flat table with N columns named Value1
I have the following table structure: <table class=ms-listviewtable> <tr class=ms-itmhover> <td class=ms-vb2>Value1</td> <td class=ms-vb2>Value2</td>
I have a table I'm trying to derive a JSON object from using the
I have a temp table like: #temp321 select * from #temp321 it's return value
I am using a complex join statement to get data from my 'items' table
Have the following update statement in SQL Server: UPDATE MY_TABLE SET COLUMN1 = FN_GETFIRSTVALUE(T.VALUE1),
I have a value in my MS SQL table column called XDATA like this:

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.