classify tables based on WHERE