"select distinct" is usually applied to a single column, so you might want
to try selecting *only* the first name column by adding it explicitly to the
Criteria, using the addSelectColumn method (or something like that, I forget
the name offhand).

-- Bill

> Hello
>
> I'm trying to do a query to find a sorted list of users with distinct
first
> name :
>
>             Criteria criteria = new Criteria();
>             criteria.addAscendingOrderByColumn(UserPeer.FIRST_NAME);
>             criteria.setDistinct();
> Iterator it  = UserPeer.doSelect(criteria).iterator();
>
> When i process this I obtain this exception :
>
> java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
> JDBC][SQLServer]ORDER BY items must appear in the select list if SELECT
> DISTINCT is specified.
>
> And for
>
>             Criteria criteria = new Criteria();
>             criteria.addOrderByColumn(UserPeer.FIRST_NAME);
>             criteria.setDistinct();
> Iterator it  = UserPeer.doSelect(criteria).iterator();
>
> I have alwaus the same error.
>
> thanks
> Guillaume
>
>
>


--
To unsubscribe, e-mail:   <mailto:turbine-torque-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:turbine-torque-user-help@;jakarta.apache.org>

Reply via email to