Allan Clarke wrote:
>
> I have this table that keps a log
> of the user search activity. For ex, on the site
> search page of the site, if a user searches for
> a keyword "test", it gets stored on the database table
> along with other details like the
> username, date/time, search category and the results
> found.
> The columns are
> DateTime, UserName, SearchKeyword, SearchCategory and
> ResultsFound

> I want to display it like this
> In the last 7 days
> powerpoint,word,excel,notepadtestUser1

SELECT
  UserName,
  SearchKeyWord,
  Count(SearchKeyWord) AS Occurences
FROM
  table
WHERE
  EXTRACT(DAYS FROM CURRENT_TIMESTAMP - DateTime) < 7
GROUP BY
  UserName,
  SearchKeyWord

Then use cfoutput with the group attribute to display everything n one
line.

Jochem


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to