Here is one way to do it.

setDistinct only adds a distinct modifier.

criteria.addSelectColumn(VUsersPeer.FIRST_NAME);
criteria.setDistinct();
Vector v = VUsersPeer.doPSSelect(criteria);

context.put( "v", v );

Produces:
SELECT DISTINCT V_USERS.FIRST_NAME FROM V_USERS

And user in my VM:
#foreach( $user in $v )
    $user.getValue(1).asString()
#end

-----Original Message-----
From: Darin Wilcox [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 06, 2002 12:47 PM
To: [EMAIL PROTECTED]
Subject: RE: Select statement with distinct


Yeah, I know about the criteria.setDistinct()...  However, that only sets
the distinct on the primary key.  This is a non-primary key value.  Is there
any other way?

Thanks.

-------------------------------------------------------------
Darin Wilcox
Web Engineer
College of Nursing
University of Utah
585-7332

>>> [EMAIL PROTECTED] 06/06/02 11:25AM >>>
criteria.setDistinct();

-----Original Message-----
From: Darin Wilcox [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, June 06, 2002 12:24 PM
To: [EMAIL PROTECTED] 
Subject: Select statement with distinct


All,

Forgive me if I have missed something in the archives, but I can't seem to
find a solution to this problem...

I am using tdk 2.1 and Oracle 8i.  I have a select statement that looks like
this:

select distinct name from employee;

However, name is not the primary key.  Is there a way to get the distinct in
there and make it work correctly?

Thanks,

- Darin

-------------------------------------------------------------
Darin Wilcox
Web Engineer
College of Nursing
University of Utah
585-7332


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to