so question, i'm trying to group some data, and also get a # of occurrences when i do it. here's a sample table:select 'ALBERT'fn,'KOHL'ln,'123 MAIN ST'addr,'PHOENIX'city,'AZ'st,'55555'zip,'1233'id,'2011-01-01'date into #temp union allselect 'ALBERT','KOHL','123 MAIN ST','PHOENIX','AZ','55555','1234','2011-01-22' union allselect 'ALBERT','KOHL','123 MAIN ST','PHOENIX','AZ','55555','1235','2011-03-18'
now basically, i'm looking to get:fn ln addr city st zip id date hits------ ---- ----------- ------- ---- ----- ---- ---------- ----ALBERT KOHL 123 MAIN ST PHOENIX AZ 55555 1235 2011-03-18 3
now i'm doing this w/ a database of about 800 million rows, i would probably write it loop though the database by SCF Codes so i can be a few million records @ a time. i would like to get the data unique by fn,ln,addr,zipany help would be greatly appreciated