I've setup a query for Pagination, however now I'm seeing that some of these records have duplicate information. I want to only group these records by a few of the columns, but also want other information along with the records. I'm used to MySQL and the Limit 0,50 feature.
So, my query (page 3 of results) looks like:
Now when I add group by to the mix, I have 2 issues:
1. If I don't group by the exact same fields I'm selecting, i get an error saying the column is invalid.
2. If I only select what I'm grouping by, the query only gives me one page.
I want to group by:
GROUP BY First_Name, Middle_Name, Last_Name
In hopes to narrow down some of these records. Thanks for any help.
So, my query (page 3 of results) looks like:
Code:
SELECT * FROM (
SELECT TOP 50 * FROM (
SELECT TOP 150 * FROM table
WHERE Field_Date IS NOT NULL
ORDER BY Last_Name ASC, First_Name ASC, Middle_Name ASC
) AS Selection
ORDER BY Last_Name DESC, First_Name DESC, Middle_Name DESC
) AS AllOfIt
ORDER BY Last_Name ASC, First_Name ASC, Middle_Name ASC
Now when I add group by to the mix, I have 2 issues:
1. If I don't group by the exact same fields I'm selecting, i get an error saying the column is invalid.
2. If I only select what I'm grouping by, the query only gives me one page.
I want to group by:
GROUP BY First_Name, Middle_Name, Last_Name
In hopes to narrow down some of these records. Thanks for any help.