Log in

View Full Version : SQL Query to delete a single pm by its id?


fusiongoddess
03-22-2007, 12:27 PM
can someone give me the sql query please to delete a single pm by its ID? thanks

Marco van Herwaarden
03-22-2007, 04:56 PM
DELETE FROM pm WHERE pmid = <pmid>

Lynne
03-23-2007, 03:48 PM
wouldn't you also want to

DELETE FROM pmtext WHERE id = <pmid>

?

Marco van Herwaarden
03-23-2007, 09:00 PM
Not really.

When a PM is sent the following happens:
- A new row is inserted into the pmtext table with the text of the PM.
- A new row is inserted into the pm table for each receipant of the PM, and 1 for the sender of the PM

Removing the row from the PM table, will make the PM unreachable for this receipant/sender.

Stale pmtext rows (ie a pmtext with no row in the pm table anymore) are cleaned up on a regular basis by a scheduled task.

fusiongoddess
03-24-2007, 01:39 AM
Thank you for this information, the both of you! :)