Search Posts

Author: Vishal P

Fetch count of values as different columns for different values in MySql

I have data in a MySQL table in the following format. I want to fetch count of string values as different column in MySql query, which means if column has 3 distinct values then 3 columns will be added to result while fetching the data from database. Tables : task table id  | task | —-|———–| 1   | TASK1 | —-|———–| 2   | TASK2 | —-|———–| 3   | TASK3     | —-|———–| priority table id  | task_id | priority  | —-|———–|———–| […]