mySql

Junior Spellweaver
Joined
Aug 9, 2004
Messages
114
Reaction score
0
hi guys..

i got a question about some scripts because it's kind a complicated.
for instance..

i have 2 tables

tbl_test
id
name
address

tbl_test2
id
music_title
location
preview


im going to left join tbl_test2 to tbl_tes...
i just want to know how would i cascade this two table inserting only 1 id to both table
like if i delete id 1 of tbl_test it will also delete the tbl_test2 id including its whole row?


btw i've done this in doctrine frameworks, but i havent in native mySql way...
 
Something like this?
Code:
SELECT * FROM tbl_test
JOIN tbl_test2 ON(tbl_test.id = tbl_test2.id)

Code:
DELETE FROM tbl_test
JOIN tbl_test2 ON(tbl_test.id = tbl_test2.id)
WHERE id = "1"

Code:
UPDATE tbl_test
JOIN tbl_test2 ON(tbl_test.id = tbl_test2.id)
SET `id` = "2"
WHERE id = "1"

(not sure about the DELETE & UPDATE.. But I'm pretty sure about the SELECT one :)

You can probably utilize something from that
 
Back