tell me the best way to print rows by the column name in mysql?

Use conditional aggregation. In MySQL:

select opposition,
    sum(dismissals = 'lbw'    ) lbw,
    sum(dismissals = 'run_out') run_out,
    sum(dismissals = 'bowled' ) bowled
from mytable
group by opposition

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top