You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Trevor Miller <we...@fox5.co.za> on 2006/07/06 07:46:13 UTC

Select Where Max

Hi All,

I have been scratching my head trying to figure out how to do the following:

"SELECT * FROM gallery WHERE views=MAX(views);"

In other words, I want to find the gallery with the most views.

Any suggestions on how to achieve this with Torque 3.2 and MySQL would be
greatly appreciated.

Regards,
Trevor



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


Re: Select Where Max

Posted by Trevor Miller <we...@fox5.co.za>.
Hi,

Thanx, that worked! Amazing how simple it is, I thought I'd have to use a
Criteria.CUSTOM.

Regards,
Trevor


> Hi,
>
> have you tried the following:
>
> Criteria criteria = new Criteria();
> criteria.add(GalleryPeer.VIEWS, "max(" + GalleryPeer.VIEWS + ")");
> List result =GalleryPeer.doSelect(criteria);
>
>
>     Thomas
>
> "Trevor Miller" <we...@fox5.co.za> schrieb am 06.07.2006 07:46:13:
>
>> Hi All,
>>
>> I have been scratching my head trying to figure out how to do the
> following:
>>
>> "SELECT * FROM gallery WHERE views=MAX(views);"
>>
>> In other words, I want to find the gallery with the most views.
>>
>> Any suggestions on how to achieve this with Torque 3.2 and MySQL would
>> be
>> greatly appreciated.
>>
>> Regards,
>> Trevor
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>


---------------------------------------------------------------------
Trevor Miller
Developer
Spiraleye Studios
trevor@spiraleye.com
www.spiraleye.com

Important Notice: Important restrictions, qualifications and
disclaimers ("The Disclaimer") apply to this email. To read this
click on the following address: http://www.spiraleye.co.za/legal
The Disclaimer forms part of the content of this email in terms
of section 11 of the South African Electronic Communications and
Transactions Act, 25 of 2002.


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


Re: Select Where Max

Posted by Thomas Fischer <fi...@seitenbau.net>.
Hi,

have you tried the following:

Criteria criteria = new Criteria();
criteria.add(GalleryPeer.VIEWS, "max(" + GalleryPeer.VIEWS + ")");
List result =GalleryPeer.doSelect(criteria);


    Thomas

"Trevor Miller" <we...@fox5.co.za> schrieb am 06.07.2006 07:46:13:

> Hi All,
>
> I have been scratching my head trying to figure out how to do the
following:
>
> "SELECT * FROM gallery WHERE views=MAX(views);"
>
> In other words, I want to find the gallery with the most views.
>
> Any suggestions on how to achieve this with Torque 3.2 and MySQL would be
> greatly appreciated.
>
> Regards,
> Trevor
>
>
>
> ---------------------------------------------------------------------
> 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