to have all the fields from the select (exept aggregate functions) in
the group by clause:
<CFQUERY NAME="GetAgentList" datasource="020">
SELECT
pa.PropertyAgentID,
pa.PropertyAgentCompanyName,
pa.PropertyAgentContactSurname,
pa.PropertyAgentContactFirstName,
pa.PropertyAgentVillageTown,
pa.PropertyAgentAuthorityLevel,
Count(pd.PropertyDataID) as PropertyCount
FROM {oj PropertyAgent pa LEFT OUTER JOIN PropertyData pd
ON pa.PropertyAgentID = pd.PropertyAgentID}
GROUP BY
pa.PropertyAgentID,
pa.PropertyAgentCompanyName,
pa.PropertyAgentContactSurname,
pa.PropertyAgentContactFirstName,
pa.PropertyAgentVillageTown,
pa.PropertyAgentAuthorityLevel
ORDER BY
pa.PropertyAgentContactSurname,
pa.PropertyAgentContactFirstName
</CFQUERY>
> -----Original Message-----
> From: Stuart Kidd [mailto:[EMAIL PROTECTED]
> Sent: donderdag 19 februari 2004 17:22
> To: CF-Talk
> Subject: RE: DB Stuff
>
> Thanks Pascal. Yes some of my Agents don't have properties
> so i'm gettin the below error:
>
> Error Executing Database Query.
> [Macromedia][SequeLink JDBC Driver][ODBC
> Socket][Microsoft][ODBC Microsoft Access Driver] You tried to
> execute a query that does not include the specified
> _expression_ 'PropertyAgentID' as part of an aggregate function.
>
> My code is below:
>
> <CFQUERY NAME="GetAgentList" datasource="020"> SELECT
> PropertyAgent.PropertyAgentID, PropertyData.PropertyAgentID,
> Count(PropertyData.PropertyDataID) as PropertyCount FROM
> PropertyAgent, PropertyData WHERE
> PropertyAgent.PropertyAgentID = PropertyData.PropertyAgentID
> GROUP BY PropertyAgent.PropertyAgentID </CFQUERY>
>
> Do you think that is why the error is coming up like so,
> because it needs an outer join?
>
> Stu
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

