0 Replies Latest reply on Nov 8, 2007 3:20 PM by vandelay

    JBossQL Filtering of most recent action by Time

    vandelay

      I am currently having a problem with my query:

      SELECT DISTINCT a.userID FROM Availablehistory a
      WHERE a.action= 'Sign On' AND a.date BETWEEN ?7 AND ?8

      The boundaries reflect the past day time limits ( ?1 = Midnight 4 days ago ?2 = 11:59:59 PM 4 days ago)

      This query is incorrect since query should only
      be taking in the most recent 'Sign On' action performed by each user,
      not all 'Sign On' actions from a user.

      So if a user performs action 'Sign On' within the past four days, this query will still return a result back since a user did "Sign On' 4 days ago.

      I want to add a condition that will drop users from the results Collection that 'Sign On' in the past 4 days and only add to the result sets users that their most recent 'Sign On' action was 4 days ago.

      Any thoughts or help will be appreciated.


      Thanks,

      Blake