473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Multiple table delete

omerbutt
638 512MB
hi i am trying to delete multiple records from 4 tables but it is not working what is wrong in this query
Expand|Select|Wrap|Line Numbers
  1. $q_subDel="delete from 
  2.                                 ".SUBJECTS." S , 
  3.                                 ".QUESTIONS." Q , 
  4.                                 ".PAPERS." P , 
  5.                                 ".ANSWERES." A , 
  6.                                 ".USER_TO_PAPERS." UTP
  7.                             WHERE 
  8.                                 S.subject_id=Q.subject_id 
  9.                                             and 
  10.                                 S.subject_id=P.subject_id 
  11.                                             and 
  12.                                 P.paper_id=UTP.paper_id 
  13.                                             and 
  14.                                 Q.question_id=A.question_id 
  15.                                             and 
  16.                                 subject_id='".$subId."'"; 
  17.  
Aug 20 '09 #1
1 1403
mwasif
802 Expert 512MB
Make sure you have all the relevant records in the tables. To confirm this run the following SELECT query
Expand|Select|Wrap|Line Numbers
  1. $q_subDel="SELECT * from  
  2.                                 ".SUBJECTS." S ,  
  3.                                 ".QUESTIONS." Q ,  
  4.                                 ".PAPERS." P ,  
  5.                                 ".ANSWERES." A ,  
  6.                                 ".USER_TO_PAPERS." UTP 
  7.                             WHERE  
  8.                                 S.subject_id=Q.subject_id  
  9.                                             and  
  10.                                 S.subject_id=P.subject_id  
  11.                                             and  
  12.                                 P.paper_id=UTP.paper_id  
  13.                                             and  
  14.                                 Q.question_id=A.question_id  
  15.                                             and  
  16.                                 subject_id='".$subId."'";
BTW, are you getting any error while executing this query?
Aug 21 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ray | last post by:
Hello all, I am attempting to delete multiple rows from multiple tables as follows: DELETE FROM attachments,responses,response_lines WHERE attachments.id IN(2,7,11) AND...
4
by: bmccollum | last post by:
I have written a trigger that's supposed to go out and delete corresponding records from multiple tables once I delete a specific record from a table called tblAdmissions. This does not work and...
3
by: sql-db2-dba | last post by:
There are 2 tables A and B with A being the parent of B. Table A ( Col1 varchar(5) Not Null ) Table B ( B_PK varchar(5) Not Null ,
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
3
by: =?Utf-8?B?S2F5xLFoYW4=?= | last post by:
In my project,i added datagridview to my form , i transfered my table to datagridview and added multiple rows and when i called dataadapther.update ,,result is ok. But when i tried it for the...
3
by: nigelesquire | last post by:
Please help! I'm trying to clone and delete multiple rows with JavaScript. I need two delete buttons that work...! I only have one for now, but it's not working properly, the output count is...
92
by: bonneylake | last post by:
Hey Everyone, Well i was hoping someone could explain the best way i could go about this. i have a few ideas on how i could go about this but i am just not sure if it would work. Right now i...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.