Re: is there a better way to do this???
From: Dan Guzman (guzmanda_at_nospam-online.sbcglobal.net)
Date: 01/20/05
- Next message: Dan Guzman: "Re: SP help"
- Previous message: Lontae Jones: "SP help"
- In reply to: jose g. de jesus jr mcp, mcdba: "is there a better way to do this???"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 19 Jan 2005 21:30:35 -0600
The best answer depends on what you are trying to accomplish. TOP is
meaningless without ORDER BY. Any arbitrary row may be returned. Perhaps
the example below is what you are looking for?
UPDATE mytable
SET
field1=MAX(field1),
field2=MAX(field2),
field3=MAX(field3)
FROM inserted
-- Hope this helps. Dan Guzman SQL Server MVP "jose g. de jesus jr mcp, mcdba" <jose g. de jesus jr mcp, mcdba@discussions.microsoft.com> wrote in message news:A48851D0-646B-4B9A-84C3-CABE22174B14@microsoft.com... > update mytable > set field1=(select top 1 field1 from inserted), > set field2=(select top 1 field2 from inserted), > set field3=(select top 1 field3 from inserted) > > --thanks!!!
- Next message: Dan Guzman: "Re: SP help"
- Previous message: Lontae Jones: "SP help"
- In reply to: jose g. de jesus jr mcp, mcdba: "is there a better way to do this???"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|