Support SELECT DISTINCT queries, fix #8