Jumping from one query problem to another... just when it was safe to  
to run a query another problem leapt out of the dungeons.

I would like to only pull the top 8 authors who have the most  
articles (articleID)

I have specified only to get the 8 maxrows but the problem i'm having  
is when i try to add to the ORDER BY COUNT(articleID) DESC

My error is:

[Macromedia][SQLServer JDBC Driver][SQLServer]Column  
'tbl_020authorDetails.authorID' is invalid in the select list because  
it is not contained in an aggregate function and there is no GROUP BY  
clause.

It can be seen at: http://www.020.com/testsql.cfm


<cfquery name="GetAuthors" datasource="user020" maxrows="8">
     SELECT
     tbl_020authorDetails.authorID,
     tbl_020authorDetails.authorFirstName,
     tbl_020authorDetails.authorSurname,
     tbl_020authorDetails.authorPhotograph,
     tbl_020authorDetails.authorAboutMe,
     tbl_020articleDetails.articleID,
     tbl_020articleDetails.articleTitle
     FROM tbl_020articleDetails
     INNER JOIN tbl_020authorDetails ON  
tbl_020articleDetails.authorID = tbl_020authorDetails.authorID
     WHERE tbl_020authorDetails.authorPhotograph <> '' AND  
tbl_020articleDetails.articleSubTypeID <> 55
     ORDER BY tbl_020authorDetails.authorID, COUNT(articleID) DESC
</cfquery>

<cfoutput query="GetAuthors" group="authorID">
<p><strong>#authorFirstName#</strong></p>

<p>my articles:</p>
<cfoutput>#articleTitle#<br /></cfoutput>
</cfoutput>

Any help would be great.

Thanks,

Stuart

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219582
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to