Link to home
Start Free TrialLog in
Avatar of panhead802
panhead802

asked on

T-SQL Update table with results from Select Count

Hello all,

Trying to run a Count on a table to get the number of records the are in between 2 dates then update a record in another tabel in MS SQL2005 Express.

This code gives me an error as I am sure it is not right, but it does help to illustrate what I am trying to do.

UPDATE NRTOTALS SET nrvalue = ((SELECT COUNT(PROG_ID) FROM DPU817
WHERE (DATEDIFF(DAY, ANNIVDATE, GETDATE()) > 30) AND (DATEDIFF(DAY, ANNIVDATE, GETDATE()) < 60)
WHERE VALUENAME = 'nr3060')

Any help would be great.
ASKER CERTIFIED SOLUTION
Avatar of Chris Luttrell
Chris Luttrell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of panhead802
panhead802

ASKER

Ooops, thanks for the help.