Retrieving Data Problem in sql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nalwyn Nessiah
    New Member
    • Apr 2008
    • 1

    Retrieving Data Problem in sql

    Hi,
    I want to retrieve the status column of a table,by comparing two columns name STime and ETime.
    The STime field value is 1130
    The ETime field value is 1230
    The Status field value is True

    if I pass value @stime,@etime it should compare the STime and ETime and should retrieve the status.
    if (etc.....@stime =1000 or @stime=1100 and @etime=1130)sta tus=false
    if(@stime=1230 and @etime=1300 or @etime=1330 .....etc)status =false
    if(etc..... @stime=1100 or @stime=1130 and @etime betw 1200 and 1230 and....etc)stat us=true

    I want the query to retrieve the status
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by Nalwyn Nessiah
    Hi,
    I want to retrieve the status column of a table,by comparing two columns name STime and ETime.
    The STime field value is 1130
    The ETime field value is 1230
    The Status field value is True

    if I pass value @stime,@etime it should compare the STime and ETime and should retrieve the status.
    if (etc.....@stime =1000 or @stime=1100 and @etime=1130)sta tus=false
    if(@stime=1230 and @etime=1300 or @etime=1330 .....etc)status =false
    if(etc..... @stime=1100 or @stime=1130 and @etime betw 1200 and 1230 and....etc)stat us=true

    I want the query to retrieve the status

    You might want all this in a function. Read more about function here

    CASE would also be helpful.

    -- CK

    Comment

    Working...