CGI interview question

SQL joins, filtering and sorting on 2 columns