I have 3 tables, t1, t2 and t3. t3 table is just a join-ref table of t1 and t2 in such a way that t3.c2 is ref index to t1.c1 and t3.c3 is a ref index to t2.c1 (t3.c1 is index for t3 table). Thus, table t3 has many records w/ same value in column 2 and 3. What I want is to select only rows from table 3 with unique c3 values. The statement:
"select * distinct from t3 where t3.c2 = 3333"
gives me 27 rows where many of them have the same c2=3333 and c3=same number, obviously. (i.e. 3333 4532, 3333 4532, 3333 4533, 3333 4534, etc.) which is not what I wanted.
All I want is to have distinctive rows with c3 unique. So, the following statement gives me exactly what I want:
select c3 distinct from t3 where t3.c2=3333
gives me 7 row with c3 distinctive (i.e. 3333 4532, 3333 4533, 3333 4534, etc.)
However, when I do it in Torque:
crit.add (c2, 3333)
crit.addSelectColumn (c3)
crit.setDistinct();
Iterator results = t3Peer.doSelect(crit).iterator()
would throw Exception at doSelect() because during the populateObject(), it found only 1 column instead of all columns as default to populate the data into it.
So, to make it short, is there a way to select records from a table with a specified, distinctive column(s) in Torque?
Thanks in advance,
Frank Nguyen
(408) 836-6235 (Cell)