I want to select the headers (and ID-s) from a table grouped by date, but like below.
The cell on the left is ID
The cell on the right is Title
The middle cell is Date
Select ID, Title, Date BY from the News group in order of Date Date DESC;
To display grouping by value as a header in MySQL, you can use the
GROUP_CONCATfunction in conjunction with theCONCATfunction to concatenate the grouped values with a string. Here is an example query:SELECT CONCAT('Group:', group_column) AS header, COUNT(*) AS count FROM your_table GROUP BY group_column;In this query, replace
group_columnwith the name of the column you want to group by, and your_table with the name of the table.CONCATFunction combines the string "Group:" with the value of group_column to create a header. TheCOUNTfunction counts the number of rows in each group.This will generate a result set with two columns: the title column and the count column. The title column will display the group value concatenated with the string "Group:".