Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Case statement

Results 1 to 5 of 5
Share This Thread →
  1. #1
    ak99 is offline Registered User
    Join Date
    Apr 2012
    Posts
    2
    Rep Power
    0

    Case statement

    i need to display when code=10 then delqdays has to be greater than 30 else dont display

    I used
    select * from abc WHERE DelqDays >=( CASE WHEN IN (10) THEN '30' END )

    Plz help

  2. #2
    Krandor is offline Contributing User
    Join Date
    Aug 2008
    Posts
    454
    Rep Power
    166
    Quote Originally Posted by ak99
    i need to display when code=10 then delqdays has to be greater than 30 else dont display

    I used
    select * from abc WHERE DelqDays >=( CASE WHEN IN (10) THEN '30' END )

    Plz help
    Code:
    select * from abc WHERE  DelqDays >= 30 AND code =10

  3. #3
    ak99 is offline Registered User
    Join Date
    Apr 2012
    Posts
    2
    Rep Power
    0
    Quote Originally Posted by Krandor
    Code:
    select * from abc WHERE  DelqDays >= 30 AND code =10
    Thanks for your help
    I think there is some misunderstanding,,it does not have filter on anything but except when code=10,,so it diplays everything when code is something else besides 10 but when code=10,,then delqdays has to be equal or greater than 30.

  4. #4
    gk53's Avatar
    gk53 is offline Contributing User
    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,535
    Rep Power
    278
    try that
    select * from abc WHERE 'Y' = case
    when code = 10 then case when delqdays =>30 then
    else 'N' end
    else 'Y' end
    GK
    __________________________________________________ _____
    if you found this post is useful click Give Rep button (bottom side on this reply ) and agree

  5. #5
    annaharris is offline Registered User
    Join Date
    Mar 2012
    Location
    USA
    Posts
    76
    Rep Power
    0
    You can make nested case where

    SELECT CASE WHEN code = 10 THEN delqdays =>30

    else "N" end

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

  1. Help with Select Case...
    By Bigced in forum ASP Development
    Replies: 9
    Last Post: January 11th, 2006, 09:07 AM
  2. My edit case statement doesn't work - again!!
    By YoungAngus in forum ASP Development
    Replies: 9
    Last Post: October 3rd, 2005, 07:25 AM
  3. only the 'delete' case statement works
    By YoungAngus in forum ASP Development
    Replies: 6
    Last Post: September 30th, 2005, 08:31 AM
  4. ASP: Unique random case statement
    By PupChow in forum Code Bank
    Replies: 2
    Last Post: November 15th, 2004, 09:52 AM
  5. SQL Statement Case selection...
    By plasma800 in forum SQL Development
    Replies: 1
    Last Post: May 4th, 2004, 05:13 AM

ASP Free Advertisers and Affiliates