Hi everyone,
I wrote a script to update a table as follows:
The problem is: there are multiple records with accountno:'95376'. I want only one row to be updated, say, that with maximum date value ("mydate" column). Can any one tell me how to do that?
Thanks
I wrote a script to update a table as follows:
Code:
IF EXISTS(SELECT * FROM contsupp WHERE accountno='95376')
BEGIN
UPDATE contsupp
SET recommend='2'
WHERE
accountno='95376'
END
ELSE
BEGIN
INSERT INTO contsupp
(accountno,recid,recommend)
SELECT
'1','1','1'
END
Thanks