query with table name prefix and sufix