i had a database with two tables a.table1,b.table2.
In a.table1 i had three columns i;e a.col1(primary key),a.col2,a.col3
In b.table2 i had three columns i;e b.col1(foreign key),b.col2,b.col3

I want to delete a row in a.table1,b.table2 whose column names are different...but iam getting error as a.col1 is a primary key... so hw can i getover this error..
i hav tried this..but is this correct..?

Delete from a.table1 where a.col1=1
Delete from b.table2 where b.col1=1

i need single query.. can any one suggest me..

Thank u

As a rule of thumb for deleting record form tables based on referential integrity .

Step 1. Delete record from child table.
Step 2. Delete record from parent table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.