Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql, Deletion in multiple table is hecktic...

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0

One problem is here , in MYSQL , i have some qries, which are not working properly, syntax error occure.

these qries are in this file...

I have two table, but both have one field same.

table's are , start and stop ,and field name is , asid. i want to delete those record which are common in those tables.
here is quries...

"
delete from start where start.asid=stop.asid;
delete from start where start.asid in (select asid from stop);
delete from start using start,stop where start.asid=stop.asid;
"
now, plz tell me why these qries are not working, although , i found that this type of qries are supported by mysql. i find this stuff in documentation, but this documentation is for 4.0.2 version of mysql which is still not available for use , i am still using, 3.2 or 4.0.1.

plz help me in these quries, i am getting lot of problem... these simple qries are not running .

 
1. delete
from start s
where exists (
select *
from stop x
where s.asid = x.asid);

2. delete
from start
where asid in (
select asid
from stop);

OK as it is (if subqueries are supported i your version of mySQL)

3. delete from start using start,stop where start.asid=stop.asid;

Dont think you can use join in that way in delete query

By the way, this statements do the same thing, you just need one of them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top