Hi everyone,

I've got a really annoying problem with mysql, and I was hoping someone 
could help.
I've got 2 tables in Mysql:

Table 1 - "Topics"

| topic_id | name | subject | comment     |
---------------------------------------------------------------------
|      1     | john   | weather| the weather today.... blah blah|


Table 2 - "Messages"

|message_id | topic_id | name | subject | comment     |
---------------------------------------------------------------------
|       12        |      1     | billy   | yes it ...| i totally agree....|

Basically, in the messages table, each row has its own unique id, but also 
a topic_id column which relates to the topic_id in the Topics table.
What I want to do is delete all messages in the message table for which the 
relating topic_id has been already deleted in the Topics table. For 
example, if the row with topic_id 5 was deleted in Topics table, I want to 
make sure there are no messages in the Messages table which have a topic_id 
of 5.

Please please, any help would be greatly appreciated. I'm running MySQL 
3.23.46 on UNIX.

TIA!

sunny


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to