I believe - the problem is not with cake. Its with the SQL you have
written.

When you use HAVING on a query, only the output is filtered after
running the query.
You should be using WHERE condition. Please read up the MYSQL manual
for details.

cheers
R

On Aug 21, 5:00 pm, Asembereng <[EMAIL PROTECTED]> wrote:
> I want to read from a database using php commands and grouping by
> timetype jobdatefrom endyear and nctype and summing the groups for
> everymonth but instead it sums up for all the months. Here are the
> Codes i wrote for that:
>
> $query = mysql_query("select distinct sum(ChargeTime) as ChargeTime,
> sum(Amount) as AmounT , ClientName,
> JobDateFrom,JobDateTo,endYear,NcType from jobs where TimeType=0 group
> by TimeType, JobDateFrom, endYear, NcType having
> JobDateFrom>=Date('$startdate') and JobDateTo=('$enddate')");
>
> thats the query i am using. Can anyone help me on this?? Its an urgent
> matter. thank you!!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to