Lets say we have a table storing mail messages and we need to show user’s mailbox: messages sent “from” and “to” the specified user.
Here is our table:
CREATE TABLE `internalmail` ( `mail_id` int(10) NOT NULL AUTO_INCREMENT, `senderaddress_id` int(10) NOT NULL, `recipientaddress_id` int(10) NOT NULL, `mail_timestamp` timestamp NULL DEFAULT NULL, … message body, etc … […]