Mysql statement problem

Can you please provide an example of both ways you do it?

Also telling us how your table looks like even with sample data helps a lot.

Of course, you want to minify the example table and avoid complicated queries or even joins.