Home » Developer & Programmer » Forms » Hi Guyz (Query Problem)
Hi Guyz [message #341158] Sun, 17 August 2008 05:52 Go to next message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
HI Guyz

I m haveing some problem anyone could solve my problem

i have four tables whic 1 is master and the rest is details and the common field is systemid.

example

Table A (system_master)

1) systemid primary key
2) empname
3) dept_id

Table B

1) systemid (ref from table a )
2) pc_name
3) dept

Table C
1) systemid (ref from table a )
2) hardware_info
3) pc_hard_info

Table D
1) systemid (ref from table a )
2) dom_name
3) ip_add

i wanna to delete the single record from the above table im trying since yesterday Sad but i didnt get the proper query how to delete the above record can some one help me to solve my problem

Waiting for replies
Re: Hi Guyz [message #341159 is a reply to message #341158] Sun, 17 August 2008 06:27 Go to previous messageGo to next message
mudabbir
Messages: 235
Registered: April 2006
Location: Kuwait
Senior Member

which table?
Re: Hi Guyz [message #341164 is a reply to message #341158] Sun, 17 August 2008 07:27 Go to previous messageGo to next message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
from All table related with SystemID
Re: Hi Guyz [message #341165 is a reply to message #341164] Sun, 17 August 2008 07:47 Go to previous messageGo to next message
mudabbir
Messages: 235
Registered: April 2006
Location: Kuwait
Senior Member

Have you used the ON DELETE CASCADE option when creating foreign keys?
Re: Hi Guyz [message #341173 is a reply to message #341158] Sun, 17 August 2008 09:00 Go to previous messageGo to next message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
no dear i need query only for that above tables

Re: Hi Guyz [message #341174 is a reply to message #341173] Sun, 17 August 2008 09:21 Go to previous messageGo to next message
mudabbir
Messages: 235
Registered: April 2006
Location: Kuwait
Senior Member

Have you created Primary key on table A and foreign keys on table B,C,D?
If you define the foreign key with the ON DELETE CASCADE option, then when you delete a record from the master table (Table A) ,all related records will be deleted from Table B,C,D)
Re: Hi Guyz [message #341182 is a reply to message #341174] Sun, 17 August 2008 10:48 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If not, you'll have to delete them manually, one by one (table, not record):
delete from table_D where systemid = :block_A.systemid;
delete from table_C where systemid = :block_A.systemid;
...

Re: Hi Guyz [message #341446 is a reply to message #341173] Mon, 18 August 2008 21:01 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
*munnabhai* wrote on Mon, 18 August 2008 00:00
no dear i need query only for that above tables


I suggest NOT making them 'query only'.

David
Previous Topic: when we use subclass attribute?
Next Topic: can you help me ... icon not apperance in tree
Goto Forum:
  


Current Time: Sat Dec 03 07:47:53 CST 2016

Total time taken to generate the page: 0.14352 seconds