mysql-error-1093

SQL DELETE with JOIN another table for WHERE condition

I have to delete rows from guide_category that have no relation with guide table (dead relations). Here is what I want to do, but it of course does not work. :) DELETE FROM guide_category AS pgc WHERE pgc.id_guide_category IN (SELECT id_guide_category FROM guide_category AS gc ...

DELETING doubled users (MySQL)

Hi I have two tables. There are users informations from two sites: p_users p_users2 There are 3726 users in first and 13717 in second. Some users in p_users2 are in p_users. I want merge this two tables to the one big table - but rows with same usernames can't be doubled. How can I do this? I tried something like this: DELETE FROM p_u...

how to delete duplicate rows from a table in mysql

I need to delete duplicate record from table in mysql. So i have a table name "employee" fields are empid, empname, empssn for getting duplicate record i have written a query SELECT COUNT(empssn), empssn FROM employee GROUP BY empssn HAVING COUNT(empssn)>1 Now i want to delete duplicate records. for that i have wr...

Deleting a row based on the max value.

How can I structure a mySQL query to delete a row based on the max value. I tried WHERE jobPositonId = max(jobPostionId) but got an error? ...

update rows with duplicate entries

I have the same situation as this other question, but I don't want to select the rows, I want to update these rows. I used the solution Scott Saunders made: select * from table where email in ( select email from table group by email having count(*) > 1 ) That worked, but I wanted to change/update a row-value in these entries, so ...