Results 1 to 2 of 2

Thread: or problem

  1. #1
    Join Date
    Jan 2005
    Posts
    362

    Unanswered: or problem

    I have this query
    Code:
    SELECT  *  FROM mytable
    where( ( day=curdate() andtime<=curtime())
    or
    ( day<curdate() and date_format( fltime,'%H:%i')<='24:00'))
    I want this.
    Code:
    If where day=curdate() and 
    time<=curtime()
    has no values to go to the
    Code:
    or( day<curdate() and 
    date_format( fltime,'%H:%i')<='24:00'))
    But always get the values for
    Code:
    or( day<curdate() and 
    date_format( fltime,'%H:%i')<='24:00'))
    what is wrong?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you need to stop and re-think

    an IF expression can have only three possible values -- TRUE, FALSE, or UNKNOWN

    obviously you have some serious data issues there if you are having these problems of "going to" some other time column
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •