Here i want to take the count like same values in table,let say example in my table Accomodation
is two time are there so,Accomodation count should come 2 and remaining count is 1
getting_fecilities
fid eventId fecilityName
1 5 Accomodation
2 5 Breakfast
3 5 Lunch
4 5 Dinner
5 6 Food(VEG)
6 5 Parking
7 5 Accomodation
MYSQL
SELECT `fecilityName`,COUNT(*) AS count FROM getting_fecilities WHERE eventId=5 group by `fecilityName`
MY Result
fecilityName count
Accomdation 1
Accomdation 1
Breakfast 1
Dinner 1
Lunch 1
Parking 1
My Expected results
fecilityName count
Accomdation 2
Breakfast 1
Dinner 1
Lunch 1
Parking 1
Your query is giving the Expected Result. Have a look at it at the below link:
SELECT `fecilityName`, COUNT(fecilityName) AS count
FROM getting_fecilities WHERE eventId = 5
group by `fecilityName`;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.