changed id to tid for q2mysql