fixed issue #31.
All tables in JOINs are now aliased to avoid MySQL error "Not unique table/alias"