logo       

subquery in delete: msg#00669

db.mysql.general

Subject: subquery in delete

Hi all,

I have a SQL question.
If I want to delete all the duplicated record in a table,
how can I do that in MySQL?
I am using MySQL 3.23.49 on AIX 4.3.3

there is a key field in the table

what I want to do is check all the duplicated record by
select order_no, count(*)
from order
group by order_no
having count(*) > 1;

then these duplicated rows can be all inserted into
another table.
but I don't know how to delete them from the original
table.

Thank you

Borus

---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <mysql-thread112916@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail
<mysql-unsubscribe-gcdmg-mysql=m.gmane.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise