mysql query solution to this problem?

Printable View