Subject | Basic SQL Update query question |
---|---|
Author | vladman992000 |
Post date | 2006-11-01T14:32:30Z |
Forgive my naivety, but I have a statement like so:
update collection COL
set COL.disp_browse = 'N'
where COL.user_no = (select u.user_no from user_account u where
u.expire_date = cast('NOW' as date));
When the Select part of the query returns multiple rows, it fails with
a Multi Rows in Singleton result set.
What is the best way to re-write this statement so that it updates all
resulting items assuming the Select returns many records?
Myles
update collection COL
set COL.disp_browse = 'N'
where COL.user_no = (select u.user_no from user_account u where
u.expire_date = cast('NOW' as date));
When the Select part of the query returns multiple rows, it fails with
a Multi Rows in Singleton result set.
What is the best way to re-write this statement so that it updates all
resulting items assuming the Select returns many records?
Myles