473,320 Members | 1,910 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,320 software developers and data experts.

delete data from two tables at the same time...

vyon13
8
cn anyone help me.. this is my query in delting data from to two tables at the same time..

Expand|Select|Wrap|Line Numbers
  1. $query = DELETE FROM tblpost AND tblreply WHERE post_id = $_GET['id'];
hope you can help me.. thanks!!!
Feb 4 '08 #1
3 8024
rpnew
188 100+
cn anyone help me.. this is my query in delting data from to two tables at the same time..

Expand|Select|Wrap|Line Numbers
  1. $query = DELETE FROM tblpost AND tblreply WHERE post_id = $_GET['id'];
hope you can help me.. thanks!!!
hi,
You can use something like this........
Expand|Select|Wrap|Line Numbers
  1. delete f,s from tblpost f , tblreply s where f.post_id='condition' and s.post_id='condition';
  2.  
I'm not sure about the where condition clause.... you can check it on google....

Regards,
RP
Feb 4 '08 #2
ifedi
60
cn anyone help me.. this is my query in delting data from to two tables at the same time..

Expand|Select|Wrap|Line Numbers
  1. $query = DELETE FROM tblpost AND tblreply WHERE post_id = $_GET['id'];
hope you can help me.. thanks!!!
Why do you want to squeeze two sql statements into one, anyway?
You could make sequential delete statements, using a delimiter (usually as semicolon) like so:
Expand|Select|Wrap|Line Numbers
  1. $sql="DELETE from tblpost WHERE id= $_GET['id']; DELETE from tblreply WHERE id=$_GET['id']";
  2. ...
  3.  
alternatively:
Expand|Select|Wrap|Line Numbers
  1. $sql = "DELETE from tblpost WHERE id = $_GET['id']";
  2. $sql .= "DELETE from tblreply WHERE id = $_GET['id']";
  3.  
Regards,
Ifedi.
Feb 8 '08 #3
vyon13
8
Why do you want to squeeze two sql statements into one, anyway?
You could make sequential delete statements, using a delimiter (usually as semicolon) like so:
Expand|Select|Wrap|Line Numbers
  1. $sql="DELETE from tblpost WHERE id= $_GET['id']; DELETE from tblreply WHERE id=$_GET['id']";
  2. ...
  3.  
alternatively:
Expand|Select|Wrap|Line Numbers
  1. $sql = "DELETE from tblpost WHERE id = $_GET['id']";
  2. $sql .= "DELETE from tblreply WHERE id = $_GET['id']";
  3.  
Regards,
Ifedi.
thanks all!! GOD Bless..
Mar 4 '08 #4

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

Similar topics

2
by: Peter CCH | last post by:
I encounter one weird problem, I have a database with around 7 GB ... when I delete a bunch of data from it, it suppose to reduce the database file size, but weirdly, the file size increase to 8...
3
by: brian kaufmann | last post by:
Hi, I had sent this earlier, and would appreciate any suggestions on this. I need to make calculations for unemployment rate for three different data sources (A,B,C) for many countries and age...
2
by: Mark Jones | last post by:
I'm trying to delete data from a DataGrid using a ButtonColumn with a CommandName="Delete" but it's not working a the min. I'm using session data which fills a DataTable which then fills the...
1
by: Daves | last post by:
a SQL query can return multiple data tables eg SELECT expression1 ... SELECT expression2 ... Can I in ASP.Net utilise this to do fewer data fetches from the server, e.g. selectively binding...
1
by: Felix_WafyTech | last post by:
Hi, I'm working with the ObjectDatasource and the application is getting more and more chatty. Is there a way I could make the ObjectDatasource support multiple DataTables that could be...
1
by: Max2006 | last post by:
Hi, I am truing to find a pattern for my Business Logic Layer to be able to work fine win ObjectDataSource's Update method. The challenge is ObjectDataSource is not able to work with an...
3
by: Betty Boop | last post by:
I am trying to import tables using an odbc connection on a periodic basis. I don't want to create a second copy of the tables, so I have to delete them all before doing the import. I found another...
3
by: prigupta2 | last post by:
frontend vb6.0 backend Ms Aaccess how to delete data from database connection "adodc"
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.