Subject | delete and subquery |
---|---|
Author | Peter Lee |
Post date | 2005-03-05T00:38:56Z |
Hi Everybody,
I'm just wondering why this query doesn't delete anything?
DELETE FROM G_USER U
WHERE U.USER_NUM NOT IN (SELECT FIRST 3 USER_NUM FROM G_USER)
The G_USER table has more than three records... if I remove the not from
the where clause, all the records get deleted, as expected. Basically,
I'm just wanting to ensure that the table g_user has only three records
in it.
Thanks,
Peter Lee
--
Peter Lee ptle@...
-----------------------------------------------------------------------
Rising Software Australia Pty. Ltd. http://www.risingsoftware.com/
Publishers of 'Auralia' - Ear Training and 'Musition' - Theory Training
Ph: +61 3 9481 3320 FAX: +61 3 9481 3380 USA Freecall: 1 888 667 7839
I'm just wondering why this query doesn't delete anything?
DELETE FROM G_USER U
WHERE U.USER_NUM NOT IN (SELECT FIRST 3 USER_NUM FROM G_USER)
The G_USER table has more than three records... if I remove the not from
the where clause, all the records get deleted, as expected. Basically,
I'm just wanting to ensure that the table g_user has only three records
in it.
Thanks,
Peter Lee
--
Peter Lee ptle@...
-----------------------------------------------------------------------
Rising Software Australia Pty. Ltd. http://www.risingsoftware.com/
Publishers of 'Auralia' - Ear Training and 'Musition' - Theory Training
Ph: +61 3 9481 3320 FAX: +61 3 9481 3380 USA Freecall: 1 888 667 7839