fix query string to include table