Each table field is set as 00 00 00 00 00 00. I am trying to find a solution to order by count each of the 00 00 00 00 00 00 number in each column field. The code below works ok but it is ugly and I am not able to order the results. Thanks!
DESIRED RESULT (example)
Number - Times it appears in column
- 01 - 100
- 02 - 99
- 03 - 98
COLUMN SAMPLE
if ($stmt = $post_con->prepare('SELECT asw FROM tb WHERE CONCAT(" ", asw, " ") LIKE CONCAT("% ", ?, " %")')) {
for($i = 1; $i < 60; $i++){
$stmt->bind_param("s", $de);
$de = sprintf('%02d', $i);
$stmt->execute();
$stmt->store_result();
$qty = $stmt->num_rows;
/* bind result variables */
$stmt->bind_result($asw);
$stmt->fetch();
echo $qty.' -> '.$de.'</br>';
$stmt->close();
}