Multiple table delete

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    #1

    Multiple table delete

    hi i am trying to delete multiple records from 4 tables but it is not working what is wrong in this query
    [code=mysql]
    $q_subDel="dele te from
    ".SUBJECTS. " S ,
    ".QUESTIONS ." Q ,
    ".PAPERS." P ,
    ".ANSWERES. " A ,
    ".USER_TO_PAPER S." UTP
    WHERE
    S.subject_id=Q. subject_id
    and
    S.subject_id=P. subject_id
    and
    P.paper_id=UTP. paper_id
    and
    Q.question_id=A .question_id
    and
    subject_id='".$ subId."'";
    [/code]
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    Make sure you have all the relevant records in the tables. To confirm this run the following SELECT query
    [CODE=php]$q_subDel="SELE CT * from
    ".SUBJECTS. " S ,
    ".QUESTIONS ." Q ,
    ".PAPERS." P ,
    ".ANSWERES. " A ,
    ".USER_TO_PAPER S." UTP
    WHERE
    S.subject_id=Q. subject_id
    and
    S.subject_id=P. subject_id
    and
    P.paper_id=UTP. paper_id
    and
    Q.question_id=A .question_id
    and
    subject_id='".$ subId."'";[/CODE]

    BTW, are you getting any error while executing this query?

    Comment

    Working...