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


Reply via email to