aspose file tools
The moose likes JDBC and the fly likes SQL Query for two tables joining Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "SQL Query for two tables joining" Watch "SQL Query for two tables joining" New topic
Author

SQL Query for two tables joining

Manoj Paul
Ranch Hand

Joined: Jan 18, 2007
Posts: 109
I have two tables A and B
Table A has two records one for Amitabh and the other for Sharukh
Table B has records of various cars posessed by Amitabh and Sharukh.....

My question is what will be the sql Query in order to delete Sharukh record in both the table... i want to delete Sharukh membership details from Table A & simultaneously delete all the rows of Table B where the cars owner is Sharukh .. Primary key in Table A is an id and in Table B has a mem_id column which is same as that of Table A id ... What is the SQL Query?

Thank you friends..
:thumb:
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56157
    
  13

Please take the time to choose the appropriate forum for your posts. This one has been moved to a more approriate forum.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
cascade delete
http://www.techonthenet.com/oracle/foreign_keys/foreign_delete.php


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: SQL Query for two tables joining
 
Similar Threads
Regarding Foreign Key Restricts when Alter data type in sql table
DELETE SQL Question
SQL Query for two tables joining
hql delete join
Selecting data from multiple tables