Update field references in table query clauses

Signed-off-by: Tom Wright <tom@inflatablecookie.com>