sqlquery test for distinct and cross join with from