DATE_ADD issues

Discussion in 'MySQL' started by ferral73, May 30, 2012.

  1. #1
    I can not get this to run, in MYSQL DATE_ISSUED is a column that exists that I need the year to add to so I am confused as to why this format is not working please advise.SELECT O.OWNER_ID,O.EMAIL,V.PERMIT_ID,V.PERMIT_DATEFROM OWNER O, VEHICLE V(SELECT DATE_ADD (DATE_ISSUED + INTERVAL 1 YEAR)ORDER BY LAST_NAME, FIRST_NAME, PERMIT_ID);
     
    ferral73, May 30, 2012 IP
  2. koko5

    koko5 Active Member

    Messages:
    394
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Hi,

    try
    ...DATE_ADD(DATE_ISSUED,INTERVAL 1 YEAR)...
    Code (markup):
    Don't use + or - : date_add ads interval, date_sub subtracts.
    Regards :)
     
    koko5, May 31, 2012 IP
  3. aderogbas

    aderogbas Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    In addition to the above comment, it looks like your query needs to be modified as well, it doesn't look like a complete query, the main query and sub select are missing "from."
     
    aderogbas, Jun 2, 2012 IP