Large SQL Table Need Group and SubGroup
Posted on 2009-04-09
I have a table that has 2.5 million records in it and I want to be able to display this data in "groups" on one specific field.
Assume the field is "Tag" and it is a VARCHAR(50).
What I want to be able to do is list all the rows grouped by the first character of the TAG.
However, because there are so many records, I also want to display this data in "pages".
For Example, for all rows that begin with "A", I want to then group by the 2nd character:
AD - AE
xxxxxx and yyyyy woudl be the remainder of the FIRST and LAST TAG name in the group.
The result would be a 26 groups under A for each letter of the alphabet. When someone selects the AA-AB group, I would then load all the Tags that have LEFT(Tag,2) in ('AA','AB')
The table is stored in a MS SQL 2000 database. Any suggestions would be greatly appreciated.