#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    13
    Rep Power
    0

    Mysql query to compare 2 types of dates when actual date unknown


    There was an error in entering funds available date for any transaction & I need to compare transaction dates with funds available dates. Is it possible to write a query when you don't know any actual dates?
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,145
    Rep Power
    4274
    Originally Posted by bstar
    Is it possible to write a query when you don't know any actual dates?
    yes
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    13
    Rep Power
    0

    Related: Update Funds_avail_date By Adding A Day


    When I input

    SET funds_avail_date = DATE_ADD(funds_avail_date, INTERVAL 1 DAY);

    I got an error message:

    Error Code: 1193
    Unknown system variable 'funds_avail_date'
  6. #4
  7. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,145
    Rep Power
    4274
    SET by itself is not a valid SQL statement

    you're looking for UPDATE
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    13
    Rep Power
    0

    Changed Set to Update


    But then I get this message:

    Error Code: 1064
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATE_ADD(funds_avail_date, INTERVAL 1 DAY)' at line 1
  10. #6
  11. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,145
    Rep Power
    4274
    Originally Posted by bstar
    But then I get this message:
    when showing an error message, please show the query that produced it
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo