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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:59:12+00:00 2026-05-22T02:59:12+00:00

In an SQL statement how does one return a string value dependent on the

  • 0

In an SQL statement how does one return a string value dependent on the value in another column?

Language is T-SQL

i want a sub query to return the result of the following pseudo code expression into a new column called Current_YTD

IF(Committed_Date >= '01/04/2011') THEN Current_YTD = 'Y'

Committed_Date is a DateTime type

  • 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-22T02:59:12+00:00Added an answer on May 22, 2026 at 2:59 am

    Assuming SQL Server (appears likely from your question history), you need the CASE statement:

    SELECT 
        CASE 
            WHEN Committed_Date >= '01/04/2011' THEN 'Y' 
            ELSE 'N' 
        END AS Current_YTD
    FROM YourTable
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL statement (MS SQL Server 2005) that does a simple calculation
Why does the PRINT statement in T-SQL seem to only sometimes work? What are
I have some SQL that does an order by case statement. It works fine.
SQL Server (2005/2008) Each of the below statements have the same result. Does anyone
What's the simplest SQL statement that will return the duplicate values for a given
I have a very complex Linq to SQL query that returns a result set
I am trying to query 2 tables using the following sql statement in an
SQL statement: INSERT INTO order (`ORDER_ID`,`SALE_CODE`,`CREATED_AT`,`UPDATED_AT`) VALUES ('2646253286','HPHS20','2009-07-11 12:07:40','2009-07-11 12:07:40') Error: You have an
Which SQL statement is faster? SELECT TOP 2 c1.Price, c2.Price, ..... c49.Price, c50.Price FROM
This SQL statement SELECT `ip`, `when` FROM `metrics` WHERE `vidID` = '1' GROUP BY

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.