How to use group by in a case where key values are stored in single cell using commas

How to use group by in a case where key values are stored in single cell using commas

I have a case where I have a table event. The event may be of various categories(many) as defined in categories table. The event table contains a column category where the ids of categories that the event belongs to is stored in a single varchar field separated by commas. eg. 2,5,18. In such a case can I/ if yes how do I use a group by case. I need to count the events on the basis of categories. But no unique key field has been defined for categories. eg category table

I have a case where I have a table event. The event may be of various categories(many) as defined in categories table. The event table contains a column category where the ids of categories that the event belongs to is stored in a single varchar field separated by commas. eg. 2,5,18. In such a case can I/ if yes how do I use a group by case. I need to count the events on the basis of categories. But no unique key field has been defined for categories. eg category table

id   categoryname

1 music

2 dance

3 some other

event table

id   eventname         category

1 dance plus 1,2

2 xyz got talent 1,3

Im expecting to count number of events on basis of categories and expect a result as:

count    category

2 music

1 dance

1 some other


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

MySQL Database Bootcamp: Go from SQL Beginner to Expert | Simpliv

MySQL Database Bootcamp: Go from SQL Beginner to Expert

SQL Full Course - SQL Tutorial For Beginners - MySQL Essentials - SQL Training

This SQL Full Course video will cover all the topics of SQL starting from scratch. This video is great for beginners who want to learn SQL and for advanced people to brush up their skills.

Learn to Build SQL Query| Ultimate SQL and DataBase Concepts|Simpliv

Learn to Build SQL Query| Ultimate SQL and DataBase Concepts