Jump to content

Return Count Of Unread Messages For Each User


jason310771

Recommended Posts

How do I get the following results..

 

The userid and the total number of unread messages they have.

 

CREATE TABLE IF NOT EXISTS `privateMessages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`convo_id` int(11) NOT NULL DEFAULT '0',
`sent_by` text NOT NULL,
`sent_to` text NOT NULL,
`subject` varchar(255) NOT NULL,
`message` text NOT NULL,
`sent_to_deleted` tinyint(1) NOT NULL DEFAULT '0',
`sent_by_deleted` tinyint(1) NOT NULL DEFAULT '0',
`status` tinyint(1) NOT NULL DEFAULT '0',
`timestamp` datetime NOT NULL,
`read` int(11) NOT NULL DEFAULT '0',
`emailNotified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`reportedby` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=85 ;

--
-- Dumping data for table `privateMessages`
--

INSERT INTO `privateMessages` (`id`, `convo_id`, `sent_by`, `sent_to`, `subject`, `message`, `sent_to_deleted`, `sent_by_deleted`, `status`, `timestamp`, `read`, `emailNotified`, `reportedby`) VALUES
(84, 83, 'ABC4EF', '1', '111', '22222', 0, 0, 0, '2012-12-07 16:18:50', 0, '0000-00-00 00:00:00', ''),
(83, 83, '1', 'ABC4EF', '111', '111', 0, 0, 0, '2012-12-07 16:09:23', 0, '0000-00-00 00:00:00', '');

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.