Hi Stuart, I'm not the world best at SQL and it helps me to build my queries in MS SQL. I keep queries running in ms sql where I can and only do it from a cfm file when absolutely necessary. Even if it needs to be done from the cfm file, I still create it in ms sql first, then copy across the sql code.
Sorry I can't help with your specific problem, but I hope you find this works for you. Jenny ----- Original Message ----- From: "Saturday (Stuart Kidd)" <[EMAIL PROTECTED]> To: "CF-Talk" <cf-talk@houseoffusion.com> Sent: Thursday, September 29, 2005 1:19 PM Subject: Now more query problems... boo hoo > 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 > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219609 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