PDA

View Full Version : URGENT HELP - delete query



nedy_03
04-27-2007, 08:11 AM
I would urgently need u're help in this situation:
-> i have these tabels: "popolo","qu_domanda","ri_risposta"
- primary key in "popolo" is "id_campagna" (contains "id_domanda" as secondary key)
- primary key in qu_domanda is "id_domanda" (contains "id_risposta" as secondary key)
- primary key in ri_risposta is "id_risposta"
I would need a query that deletes all the rows from the table "popolo" witch have a certain "id_risposta" in the table "ri_risposta" ...
PLS HELP ... is a matter of hours till I lose the project if I wan't be able to do that! ...

nedy_03
04-27-2007, 09:06 AM
i tried :

DELETE *
FROM (popolo INNER JOIN qu_dom ON popolo.Id_camp=qu_dom.Id_camp) INNER JOIN ri_risp ON qu_dom.Id_dom=ri_risp.id_dom
WHERE ri_risp.id_risp=2;

But i get the error : "specify the table containing the records toy want to delete"

asingh
04-27-2007, 06:34 PM
Hi,

This should work...you have to specify the table to delete from:

DELETE *
FROM popolo INNER JOIN qu_dom ON (popolo.Id_camp=qu_dom.Id_camp) AND (qu_dom.Id_dom=ri_risp.id_dom)
WHERE ri_risp.id_risp=2;

nedy_03
04-28-2007, 12:19 AM
thx