homepage Welcome to WebmasterWorld Guest from 23.23.2.137
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
matrix of data
jackvull




msg:4291251
 6:04 pm on Apr 2, 2011 (gmt 0)

I have a table with a list of companies and I need to run correlation data on each of the combinations:

CompanyID, Code, Name, sectorcode
1 AAA AAA 4
2 BBB BBB 4
3 CCC CCC 4
4 DDD DDD 4
5 EEE EEE 5
6 FFF FFF 5
7 GGG GGG 5

So, I must only run the sproc on companies in the same group, ie all those in group 4. I have to compare 1 vs 2, 1vs3, 1vs4, 2vs3,2vs4, and 3vs 4 or any combination of up to 10 companies in each group.

What is the best way to write a loop for this to run multiple combinations?

SELECT sectorId, COUNT(*) FROM `companies` GROUP BY sectorId HAVING COUNT(*) > 1;
Take the sectorId from above and get the company codes.
Need something here to work out what combinations to run:
CALL GetStats ('AAA', 'BBB');
end loop
next sectorcode

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved