fixed mysql querying error with GROUP BY
access logic loops thru multiple checks
AND logic when checking multiple checks