Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Update First Few Records
Thu, Dec 31 2009 10:52 AMPermanent Link

Stuart Kelly
Does ElevateDB support limit in a update statement?  

I want to update only the first few matching records, for example:

update temp
set link_id = 1
where no = 'ABC'
and plu = '1234'
and link_id = 0
limit 2

Happy new year, Stu
Thu, Dec 31 2009 12:50 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Stuart,

<< Does ElevateDB support limit in a update statement? >>

Not directly, but you can do it like this:

update temp
set link_id = 1
where <uniquecolumn> in
       (select <uniquecolumn> from temp
         where no = 'ABC' and plu = '1234' and link_id = 0
         range 1 to 2)

Just replace <uniquecolumn> with a column name that uniquely identifies a
row.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image