I have a table of data:
where ID is unique & the rest isn't.
I also have a table of just
where Division is Unique
What I'd like is for each Division in tCriteria, return the top 100 rows from tData where tCriteria.Division=tCriteria.Division so if there are 5 records in tCriteria, I will get 500 records.
I'm using SQL Server 2005 and know I can use cursors, but I'm sure there is a set based way.
Any thoughts?
Ben
----------------------------------------------
Ben O'Hara
Code:
tData:
ID,Division,Some,Stuff,Here
where ID is unique & the rest isn't.
I also have a table of just
Code:
tCriteria:
Division
where Division is Unique
What I'd like is for each Division in tCriteria, return the top 100 rows from tData where tCriteria.Division=tCriteria.Division so if there are 5 records in tCriteria, I will get 500 records.
I'm using SQL Server 2005 and know I can use cursors, but I'm sure there is a set based way.
Any thoughts?
Ben
----------------------------------------------
Ben O'Hara
David W. Fenton said:We could be confused in exactly the same way, but confusion might be like Nulls, and not comparable.