db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ronny Walter" <mailingli...@freenet.de>
Subject AW: Select Distinct
Date Fri, 23 May 2003 20:15:27 GMT
Yes of course, but this method is a member of class ContentPeer:

/**
	 * @return all providers sorted by the Name (ASC)
	 * @throws TorqueException
	 */
public static List getProviders() throws TorqueException{
		Criteria criteria = new Criteria();
	
criteria.addAscendingOrderByColumn(ContentPeer.PROVIDER);
		criteria.setDistinct();
		Log.debug("SQL for getProviders: " +
ContentPeer.createQueryString(criteria));
		return doSelect(criteria);
	}

Thatswhy I call the method this.doSelect(crit);

Greetings
Ronny


-----Urspr√ľngliche Nachricht-----
Von: Pavel Kusch [mailto:pavel@icecentric.com] 
Gesendet: Freitag, 23. Mai 2003 22:12
An: Turbine Torque Users List
Betreff: Re: Select Distinct

If I remember well you have to use XXXPeer.doPSSelect(criteria) instead
of
doSelect

With regards,

Pavel Kusch

----- Original Message -----
From: "Ronny Walter" <mailinglists@freenet.de>
To: <torque-user@db.apache.org>
Sent: Friday, May 23, 2003 3:03 PM
Subject: Select Distinct


> Hello list,
>
> i have a little problem with torque:
>
> My Code looks like this:
>
> Criteria criteria = new Criteria();
> criteria.addAscendingOrderByColumn(ContentPeer.PROVIDER);
> criteria.setDistinct();
> Log.debug("SQL for getProviders: " +
> ContentPeer.createQueryString(criteria));
> return doSelect(criteria);
>
> The logfile says:
>
> [23 Mai 2003 21:53:05 DEBUG] - SQL for getProviders: SELECT DISTINCT
> content.PROVIDER FROM  ORDER BY content.PROVIDER ASC
>
> The problem is, that this SQL-Statement is incorrect. Where is the
> tablename?
> But I get Results with this statement, but the distinct doesn't work.
>
> The table looks like this:
>
> Id provider topic link
> 1 Test hello http
> 2 Test hello2 ftp
> 3 MyTest hello ssh
>
> I want the following resultset:
> Test
> MyTest
>
> But I get:
>
> Test
> Test
> MyTest
>
>
> What's wrong?
>
> Thanks for any help.
>
> Ronny
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org




Mime
View raw message