Yes, this is a common misunderstanding of the Torque model. You need to remember that Torque <Table>Peer methods are generally designed to return records (as objects) from the DB. In order to do this, all fields from a table must be included in the query. SQL Distinct statements have some limitations on what types of columns can be included on them (generally not a good thing to ask for distinct LONGVARCHAR o BLOB type fields..). This is probably the underlying cause of the error.
There are two ways to solve this. The first is to use the "Village" records methods to get the native results set. Then parse thru them to get the values you want. (Not much different than just doing a native Java SQL but...) The second is to use a SqlEnum.CUSTOM statement and your distinct criteria to add a subselect "IN" clause in a separate criteria to return the matching records. E.g., the equivalent of: Select Table.* from table where id in ( select distinct id from table2 where x = 1 ) Good Luck Greg Duke CE Privacy Statement Please be advised that this e-mail and any files transmitted with it are confidential communication or may otherwise be privileged or confidential and are intended solely for the individual or entity to whom they are addressed. If you are not the intended recipient you may not rely on the contents of this email or any attachments, and we ask that you please not read, copy or retransmit this communication, but reply to the sender and destroy the email, its contents, and all copies thereof immediately. Any unauthorized dissemination, distribution or copying of this communication is strictly prohibited.
