Jump to content

Please help me this problem !


haibec

Recommended Posts

Hi Guys!I have a table User includes : ID, Level, Lastlogout . I want create a function have mission : Scan all user from level 1 to level N already logout in space time : Example : from 08/18/2006 to 08/20/2006 . Please help me!

Link to comment
Share on other sites

Well, if this is MS SQL Server you can say something like:
SELECT * FROM User WHERE (Level BETWEEN 1 AND n) AND (Lastlogout BETWEEN '18 Aug 2006' AND '20 Aug 2006')

Okie thanhk you! But my problem is : With each level i want scan how many logout in that space time!
Link to comment
Share on other sites

Okie thanhk you! But my problem is : With each level i want scan how many logout in that space time!
Well, still assuming this is MS SQL Server or Access, and depending on what you want to do with the result, you can say something like (Access syntax this time):
SELECT  [Level], COUNT(*) AS NumUsersAtLevel FROM User WHERE ([Level] BETWEEN 1 AND n) AND (Lastlogout BETWEEN #18 Aug 2006# AND #20 Aug 2006#)GROUP BY [Level]ORDER BY [Level]

Link to comment
Share on other sites

Well, still assuming this is MS SQL Server or Access, and depending on what you want to do with the result, you can say something like (Access syntax this time):
SELECT  [Level], COUNT(*) AS NumUsersAtLevel FROM User WHERE ([Level] BETWEEN 1 AND n) AND (Lastlogout BETWEEN #18 Aug 2006# AND #20 Aug 2006#)GROUP BY [Level]ORDER BY [Level]

Oh! Very well!Thank o lot!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...