Created
August 11, 2010 18:16
-
-
Save llamapope/519433 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* The TOP value is the page count, the inner TOP value is where to start from. | |
* All where and ORDER BY statements need to be the same | |
*/ | |
SELECT TOP 50 | |
id, lastAction, userAgent, sessionStartedAt, sessionEndedAt, | |
/* optionally get the total count for the filtered set */ | |
( | |
SELECT COUNT(id) | |
FROM tbl_session_logs | |
WHERE userAgent LIKE '%Firefox%' | |
) AS totalRecords | |
FROM tbl_session_logs | |
WHERE id NOT IN | |
( | |
SELECT TOP 50 id FROM tbl_session_logs | |
WHERE userAgent LIKE '%Firefox%' | |
ORDER BY id desc | |
) | |
AND userAgent LIKE '%Firefox%' | |
ORDER BY id desc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment