I have a fb_requests table. 
I would like to select game_selected column based on accept_status, if accept_status count < 4 , i want to select those rows. tried hard to get it working, please help me to solve this issue.
This is my create table code
CREATE TABLE `fb_requests` (
`id` int(60) NOT NULL AUTO_INCREMENT,
`user_id` int(60) DEFAULT NULL,
`fb_user_id` varchar(255) DEFAULT NULL,
`request_id` varchar(255) DEFAULT NULL,
`game_selected` int(60) DEFAULT NULL,
`accept_status` int(60) DEFAULT NULL COMMENT '0 = pending 1 = accept',
`created_date` datetime DEFAULT NULL,
`modified_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=190 DEFAULT CHARSET=latin1
Tried this code. i know its not syntactically correct but tried it.
Select
game_selected
from
fb_requests
where
user_id = 17
&&
(
count(accept_status =1) < 4
)
group by
game_selected;
Thanks in advance.
CREATE TABLEcode (posted as text, with irrelevant columns omitted) and a fewINSERT INTOqueries with sample data are more useful than a picture of your data because it allows potential answerers to actually test the query.