Perhaps something like this would work... SELECT A.categoryId, MAX(A.posted) AS most_recent FROM ... WHERE ... GROUP BY A.categoryId
Clark RebatePlace.com -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Phillip B Sent: Tuesday, August 19, 2003 2:12 PM To: SQL Subject: first record from each category I have a query that will give me all the records in all the categories. No I would like to get the newest record in each category. I'm using cf 4.5 and access for the db. Any suggestions? Here is the query to get all the records. SELECT A.id, A.categoryId, A.userId, A.title, A.posted, U.alias, C.name FROM article A, user U, category C WHERE A.userId = U.id AND A.categoryId = C.id ORDER BY C.name Phillip B. www.LoungeRoyale.com www.FillWorks.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/lists.cfm?link=t:6 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:6 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=<:emailid:>.<:userid:>.<:listid:> Get the mailserver that powers this list at http://www.coolfusion.com
