At 07:51 PM 2/26/2007, Miles Thompson wrote:
At 10:42 PM 2/25/2007, mos wrote:

At 06:13 PM 2/25/2007, Miles Thompson wrote:

Would someone please check this delete query?

This should delete all rows from the geodesic_user_data that have no match in the subscriber table, but another set of eyes would be appreciated.

DELETE geodesic_user_data
FROM geodesic_user_data
LEFT JOIN subscriber ON geodesic_classifieds_userdata.id=subscriber.GeoClassID
WHERE subscriber.GeoClassID IS NULL;

Our hosting company uses MySQL 4.0.17 so the subquery approach is not possible.

Thanks in advance - Miles

Miles,
        It looks fine but you could have checked it yourself using:

select *
FROM geodesic_user_data
LEFT JOIN subscriber ON geodesic_classifieds_userdata.id=subscriber.GeoClassID
WHERE subscriber.GeoClassID IS NULL;
--

Thanks Mos, and to everyone else who responded.

I had tested it with a SELECT; it was just that other set of eyes that I needed for confirmation.

I did what I should have donein the first place - exported the appropriate tables with data, created them on my computer, and tested the deletes. They worked fine.

Tomorrow evening they will get run for real.

Regards - Miles

Miles,
I always back up the data if I'm not sure what the SQL will do to it. I use:

create table bu_MyTable select * from MyTable

This builds a backup table without the indexes so I can easily copy the data back using an Insert statement.
Good luck tomorrow. :)

Mike
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to