Hi, sorry to post OT but i cant find the MySQL newsgroup, however i am
hoping to pick up on some expert advice from php/mysql gurus here. I'm
having some trouble performing a delete across two tables.
The tables i have are:
questionnaires (id, name);
questionnaire_q uestions (questionnaires _id, id, name, qf_type)
The questionnaire_q uestions table contains a list of questions for a
specific questionnaire (indicated by the questonnaires_i d). I would
like to remove a questionnaire, and when doing so all corresponding
questionnaire_q uestions who have matching id's (questionnaires .id =
questionnaire_q uestions.questi onnaires_id).
I have this statement, however it only works if a questionnaire has
questions... however i would like it to delete even if no questions
exist for that specific questionnaire. The SQL i am using is:
delete questionnaires, questionnaire_q uestions FROM questionnaires,
questionnaire_q uestions WHERE questionnaires. id =
questionnaire_q uestions.questi onnaires_id AND questionnaires. id =
THE_QUESTIONAIR E_TO_DELETE_ID
Thanks in advance, any help much appreciated.
Chris
hoping to pick up on some expert advice from php/mysql gurus here. I'm
having some trouble performing a delete across two tables.
The tables i have are:
questionnaires (id, name);
questionnaire_q uestions (questionnaires _id, id, name, qf_type)
The questionnaire_q uestions table contains a list of questions for a
specific questionnaire (indicated by the questonnaires_i d). I would
like to remove a questionnaire, and when doing so all corresponding
questionnaire_q uestions who have matching id's (questionnaires .id =
questionnaire_q uestions.questi onnaires_id).
I have this statement, however it only works if a questionnaire has
questions... however i would like it to delete even if no questions
exist for that specific questionnaire. The SQL i am using is:
delete questionnaires, questionnaire_q uestions FROM questionnaires,
questionnaire_q uestions WHERE questionnaires. id =
questionnaire_q uestions.questi onnaires_id AND questionnaires. id =
THE_QUESTIONAIR E_TO_DELETE_ID
Thanks in advance, any help much appreciated.
Chris
Comment