i want to count multiple values from 3 columns and sorted descending using PHP mysqli, and I can't do it.
| name1 | name2 | name3 |
|---|---|---|
| mike | jack | rose |
| jack | mike | Mary |
| jack | Mary | John |
expect output:
jack 3
mike 2
mary 2
rose 1
John 1
My code:
$query = "select count(*) as c from work" ;
$result = $con->query($query);
$count = $result->fetch_object()->c;