Gareth Hughes wrote:
> I'm turning my brain to mush with a SQL conundrum and wonder if anyone can 
> offer some help.
> 
> I keep a record of what people searched for, the date/time they searched for 
> it and the page they were on when they searched. My table consists of three 
> columns 'search_criteria', 'search_datetime' and 'search_page'.
> 
> What I can't figure out is how to produce reports using distinct values such 
> as 'the 10 most recent searches' where I get ten unique results even if 
> there are duplicates in the most recent db entries.
> 
Maybe something like...

SELECT TOP 10 search_criteria, search_page, max(search_datetime) AS 
latestdate
FROM tblSearches
GROUP BY search_criteria, search_page
ORDER BY latestdate DESC

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:257196
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to