Update Statement

  • Im trying to update a table but having difficulty, if I just run the sql statment I retrieve data but cant update a table (0 rows updated).

    Does anyone see where Ive made a mistake?

    update sqldate_tbl

    set last_date = (select max(dt) from d_dates where date_id in (select distinct date_id from f_daily_sales))

  • That is going to update every single row in the sqldate_tbl table. Is that your intention?

    The only reason that could be not updating any rows is if there are no rows in the table. Is that the case? If not, is there a trigger on that table?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Its been a looonnnnggggg day, there was not record in the table.

    I think its time to close up. Thanks

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply