Hi to all,
I created the following two table
--------------------------------------
create table mail(mid integer primary key, name varchar(20) )
create table phone( pid integer foreign key references mail(email), phone integer)
-----------------------------------------
After inserting records on both table, now i want delete perticular record from table say 'delete record of pid=12'. that means, i have to delete record of pid=12 from oth table. so, i ran following query.
-----------------------------------------------
delete from mail, phone on mail.mid=phone.pid where pid=12
------------------------------------------------
but i got the error like 'check the syntax near from', what to do then to get the proper output.


Thanks & regards,
Pooja.

do something like this

DELETE FROM MAIL INNER JOIN PHONE ON MAIL.MID = PHONE.PID
WHERE PHONE.PID = 12

Since MAIL.MID has to equal PHONE.PID and PHONE.PID has to equal 12, we know that MAIL.MID has to equal 12 by the transitive property of equality so it's just

DELETE FROM MAIL WHERE MAIL.MID = 12
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.