Thanks! But is there a posibility to use MAX without SQl-Template,
because I need also the IN-Function and MySQL 4.x doesn´t support a
selection in a selection.
In PHP I use: "SELECT Max(w) AS w, Max(r) AS r, Max(e) AS e, Max(d) as
d FROM $grouptable WHERE id IN (".sql2in("SELECT
$user2grouptable.group_id FROM $user2grouptable WHERE user_id=$userid").")";
Any idea?
Thanks for your help
Gr
PK
Andrus Adamchik schrieb:
>> Is there any posibility to use the MAX-Function?
>
>
> Yes, and you are on the right track with SQLTemplate. You just need
> to make sure that query includes ALL columns from the "rights" DbEntity.
>
> Andrus
>
>
>
> On Jan 28, 2006, at 1:49 PM, Chronos wrote:
>
>> Hey!
>>
>> I need your help:
>>
>> SQLTemplate rawSelect = new SQLTemplate(Rights.class, "SELECT id,
>> MAX(r)
>> AS r, MAX(e) AS e, MAX(d) AS d, MAX(c) AS c FROM rights WHERE
>> document_id=220 AND group_id=1 GROUP BY group_id", true);
>> rawSelect.setFetchLimit(fetchlimit);
>> rawSelect.setFetchingDataRows(true);
>> List grpIds = ctxt.performQuery(rawSelect);
>>
>> If I use "rawSelect.setFetchingDataRows(true)" the result is correct,
>> but if I use objectstyle, the result is empty.
>>
>> Result of 1:
>> org.objectstyle.cayenne.DataRo..922221[version=-9223372036854775806,
>> replaces=-9223372036854775808, values={d=true, r=true, c=false, id=222,
>> e=true}]
>>
>> Result of 2:
>> {[]<oid: <ObjectId:Rights, id=222>; state: hollow>}
>>
>> Is there any posibility to use the MAX-Function?
>>
>> Thanks
>>
>> PK
>>
>
>
This archive was generated by hypermail 2.0.0 : Sun Jan 29 2006 - 04:03:10 EST