Even though I created a small temp table, Declare/Fetch was still SSSSLLLLOOOOWWWW.
I'll test your suggestion later today.
...
At 04:28 PM 8/23/2010, Albert Berry wrote:
Try this, Dennis, You will have to figure out the table names and column names as appropriate, of course.
SELECT B.multikeycolumns, COUNT(*) AS MyCount +
FROM <B tablename> B, <C tablename> C +
WHERE B.col1 = C.col1 AND B.col2 = B.col2 etc +
GROUP BY B.multikeycolumns
This will return
Col1, Col2, Col ..., MyCount
Albert
Dennis Fleming wrote:
Every time I resort to Declare Cursor, Fetch, etc., I know there was a Query that would have done the trick. I tried to create a temp table/view and use group by and having, and then resorted to Select Into, and Update...
Three tables A, B & C, but A is used just to get the right multi key to use in B & C.
B is a one-to-many to C
I want to count the rows in C which have the multi key value, and store that number in a fourth table which has the multi key found in A.
TIA,
Dennis
*****
Dennis Fleming
IISCO
www.TheBestCMMS.com
Phone: 570 775-7593
Mobile: 570 351-5290
Dennis Fleming
IISCO
Phone: 570 775-7593
Mobile: 570 351-5290

