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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DELETE statment

Status
Not open for further replies.

DJKAOS

Technical User
Joined
Jun 30, 2000
Messages
101
Location
US
I'm using MySQL so I can't use subquerys anyway

How can I do this.
I have 3 tables
Parts, Shipments, Suppliers

I need to delete the shipment records that shipped green parts. the part color is located int he Parts table.

I think this will work in Microcsoft SQL but I dont know to do it in MySQL.

Delete from Shipments
where pno in(select pno from Parts where color = 'green');


is there any way to say like...
Delete Shipments from Shipments, Parts
where Parts.color = 'green'

I'm pretty sure that wont work but there must be some way to do it?

Thanks
 
Don't know if this will work in MySQL. Probably check the MySQL forum or try it:

DELETE Shipments
FROM Shipments A, Parts B
WHERE A.Pno = B.Pno
AND B.Color = 'Green'
 

There is a MySQL forum (forum436). That would be the best place to ask your question.

You could modify your example slightly and it may work depending on your version of MySQL.

Delete Shipments
From Shipments, Parts
Where Shipments.pno=Parts.pno
And Parts.color = 'green'
Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top