Error in select statement when setting up a custom report