changed table to query-alias and modified torque sql to suit