Tag custom sql with multiple tables