karimali831 Posted August 18, 2012 Share Posted August 18, 2012 Hi, I have a basic group league setup for 16 signups, 8 registers in group A and other 8 in group B and use two unions in my query to generate all combinations (all vs. all) which means it will always be 16 / 2 (A and B) * 7 weeks = 56 matches. (28 matches for group A and 28 for group B) each competitor will have 7 matches each and I am trying to split these matches in separate tables and just haven't got a clue to how or where to start? There should be 7 tables showing 4 matches each per group. Query:- safe_query("INSERT INTO ".PREFIX."cup_matches ($type, $type_opp, matchno, clan1, clan2, comment, 1on1) (SELECT a.$type, a.$type_opp, a.matchno, a.clan1, b.clan2 AS 'versus', a.comment, a.1on1 FROM ".PREFIX."cup_matches a JOIN ws_bi2_cup_matches b ON a.$type = b.$type AND b.$type = '$let_alpha' AND b.matchno = '$ID' AND a.clan2 != b.clan2 AND b.type = 'gs' WHERE a.matchno = '$ID' AND a.type = 'gs') UNION (SELECT a.$type, a.$type_opp, a.matchno, a.clan1, b.clan1 AS 'versus', a.comment, a.1on1 FROM ".PREFIX."cup_matches a JOIN ws_bi2_cup_matches b ON a.$type = b.$type AND b.$type = '$let_alpha' AND b.matchno = '$ID' AND a.clan1 < b.clan1 AND b.type = 'gs' WHERE a.matchno = '$ID' AND a.type = 'gs') UNION (SELECT a.$type, a.$type_opp, a.matchno, a.clan2, b.clan2 AS 'versus', a.comment, a.1on1 FROM ".PREFIX."cup_matches a JOIN ws_bi2_cup_matches b ON a.$type = b.$type AND b.$type = '$let_alpha' AND b.matchno = '$ID' AND a.clan2 < b.clan2 AND b.type = 'gs' WHERE a.matchno = '$ID' AND a.type = 'gs') ORDER BY clan1 DESC, versus"); Table: http://s13.postimage.org/48mcpf1dx/solved.png Anyone understand what I am trying to do? Thanks for any help. Link to comment https://forums.phpfreaks.com/topic/267271-grouping-into-weeks/ Share on other sites More sharing options...
serien Posted August 18, 2012 Share Posted August 18, 2012 Your question is a bit hard to make out, at least for me. So you are basically creating a script that generates team match-ups in a league, one team vs another team. That part makes sense. The next is a tad unclear. How are you wanting to split the information? one table for each competitor showing all of their matches? Perhaps a little more insight into how you want the final tables organized would be helpful in finding an answer Link to comment https://forums.phpfreaks.com/topic/267271-grouping-into-weeks/#findComment-1370559 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.