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', '');

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.