Count the number of matching rows.
Limit the query to this number of answers
Order the result by s in the order the fields are defined in T.
Convert to a SQL statement that can e.g. be pretty printed.
See Implementation