karimali831 Posted September 8, 2010 Author Share Posted September 8, 2010 Thanks again for your reply. I made a backup so the table in my post will be the same how it is now. I used your query, and I get this list: Looks like it is getting every combination from all rows. I need all combinations where ladID = 'b' clan1 = 8 clan2 = 2627 clan1 = 101 clan2 = 2627 clan1 = 62 clan2 = 2627 clan1 = 87 clan2 = 2627 clan1 = 118 clan2 = 2627 clan1 = 143 clan2 = 2627 clan1 = 38 clan2 = 2627 clan1 = 75 clan2 = 2627 clan1 = 113 clan2 = 2627 clan1 = 111 clan2 = 2627 clan1 = 205 clan2 = 2627 clan1 = 155 clan2 = 2627 clan1 = 229 clan2 = 2627 clan1 = 258 clan2 = 2627 clan1 = 128 clan2 = 2627 clan1 = 34 clan2 = 2627 clan1 = 340 clan2 = 2627 clan1 = 275 clan2 = 2627 clan1 = 76 clan2 = 2627 clan1 = 379 clan2 = 2627 clan1 = 274 clan2 = 2627 clan1 = 297 clan2 = 2627 clan1 = 342 clan2 = 2627 clan1 = 46 clan2 = 2627 clan1 = 382 clan2 = 2627 clan1 = 2147483647 clan2 = 2627 clan1 = 1 clan2 = 2627 clan1 = 2617 clan2 = 2627 clan1 = 1 clan2 = 2627 clan1 = 2609 clan2 = 2627 clan1 = 2611 clan2 = 2627 clan1 = 2621 clan2 = 2627 clan1 = 2625 clan2 = 2627 clan1 = 2629 clan2 = 2627 clan1 = 8 clan2 = 2619 clan1 = 101 clan2 = 2619 clan1 = 62 clan2 = 2619 clan1 = 87 clan2 = 2619 clan1 = 118 clan2 = 2619 clan1 = 143 clan2 = 2619 clan1 = 38 clan2 = 2619 clan1 = 75 clan2 = 2619 clan1 = 113 clan2 = 2619 clan1 = 111 clan2 = 2619 clan1 = 205 clan2 = 2619 clan1 = 155 clan2 = 2619 clan1 = 229 clan2 = 2619 clan1 = 258 clan2 = 2619 clan1 = 128 clan2 = 2619 clan1 = 34 clan2 = 2619 clan1 = 340 clan2 = 2619 clan1 = 275 clan2 = 2619 clan1 = 76 clan2 = 2619 clan1 = 379 clan2 = 2619 clan1 = 274 clan2 = 2619 clan1 = 297 clan2 = 2619 clan1 = 342 clan2 = 2619 clan1 = 46 clan2 = 2619 clan1 = 382 clan2 = 2619 clan1 = 2147483647 clan2 = 2619 clan1 = 1 clan2 = 2619 clan1 = 2620 clan2 = 2619 clan1 = 1 clan2 = 2619 clan1 = 2609 clan2 = 2619 clan1 = 2611 clan2 = 2619 clan1 = 2621 clan2 = 2619 clan1 = 2625 clan2 = 2619 clan1 = 2629 clan2 = 2619 clan1 = 8 clan2 = 2612 clan1 = 101 clan2 = 2612 clan1 = 62 clan2 = 2612 clan1 = 87 clan2 = 2612 clan1 = 118 clan2 = 2612 clan1 = 143 clan2 = 2612 clan1 = 38 clan2 = 2612 clan1 = 75 clan2 = 2612 clan1 = 113 clan2 = 2612 clan1 = 111 clan2 = 2612 clan1 = 205 clan2 = 2612 clan1 = 155 clan2 = 2612 clan1 = 229 clan2 = 2612 clan1 = 258 clan2 = 2612 clan1 = 128 clan2 = 2612 clan1 = 34 clan2 = 2612 clan1 = 340 clan2 = 2612 clan1 = 275 clan2 = 2612 clan1 = 76 clan2 = 2612 clan1 = 379 clan2 = 2612 clan1 = 274 clan2 = 2612 clan1 = 297 clan2 = 2612 clan1 = 342 clan2 = 2612 clan1 = 46 clan2 = 2612 clan1 = 382 clan2 = 2612 clan1 = 2147483647 clan2 = 2612 clan1 = 1 clan2 = 2612 clan1 = 2620 clan2 = 2612 clan1 = 2617 clan2 = 2612 clan1 = 1 clan2 = 2612 clan1 = 2611 clan2 = 2612 clan1 = 2621 clan2 = 2612 clan1 = 2625 clan2 = 2612 clan1 = 2629 clan2 = 2612 clan1 = 8 clan2 = 2630 clan1 = 101 clan2 = 2630 clan1 = 62 clan2 = 2630 clan1 = 87 clan2 = 2630 clan1 = 118 clan2 = 2630 clan1 = 143 clan2 = 2630 clan1 = 38 clan2 = 2630 clan1 = 75 clan2 = 2630 clan1 = 113 clan2 = 2630 clan1 = 111 clan2 = 2630 clan1 = 205 clan2 = 2630 clan1 = 155 clan2 = 2630 clan1 = 229 clan2 = 2630 clan1 = 258 clan2 = 2630 clan1 = 128 clan2 = 2630 clan1 = 34 clan2 = 2630 clan1 = 340 clan2 = 2630 clan1 = 275 clan2 = 2630 clan1 = 76 clan2 = 2630 clan1 = 379 clan2 = 2630 clan1 = 274 clan2 = 2630 clan1 = 297 clan2 = 2630 clan1 = 342 clan2 = 2630 clan1 = 46 clan2 = 2630 clan1 = 382 clan2 = 2630 clan1 = 2147483647 clan2 = 2630 clan1 = 1 clan2 = 2630 clan1 = 2620 clan2 = 2630 clan1 = 2617 clan2 = 2630 clan1 = 1 clan2 = 2630 clan1 = 2609 clan2 = 2630 clan1 = 2611 clan2 = 2630 clan1 = 2621 clan2 = 2630 clan1 = 2625 clan2 = 2630 Quote Link to comment Share on other sites More sharing options...
mikosiko Posted September 8, 2010 Share Posted September 8, 2010 did you use this query? $query = mysql_query("SELECT a.clan1, b.clan2 from ".PREFIX."cup_matches a, ".PREFIX."cup_matches b WHERE a.clan2 != b.clan2 AND a.matchno = '1' AND b.matchno = '1' AND b.ladID='b'"); because this one gave me the right results Quote Link to comment Share on other sites More sharing options...
karimali831 Posted September 8, 2010 Author Share Posted September 8, 2010 Yes but it is getting all combinations. Are you using the data I only gave you? I think this may work: WHERE a.clan2 != b.clan2 AND a.matchno = '1' AND b.matchno = '1' AND a.ladID='b' AND b.ladID='b')") I'll give it a shot.. let me know if it won't. Quote Link to comment Share on other sites More sharing options...
mikosiko Posted September 8, 2010 Share Posted September 8, 2010 hummm.. curious... my last select work perfect for me... (be aware that I did post one before this... maybe you are using the incorrect one) $query = mysql_query("SELECT a.clan1, b.clan2 from ".PREFIX."cup_matches a, ".PREFIX."cup_matches b WHERE a.clan2 != b.clan2 AND a.matchno = '1' AND b.matchno = '1' AND b.ladID='b'"); and I used your data a populate the table with several more to be sure that it is working... what you wrote should work too... Quote Link to comment Share on other sites More sharing options...
karimali831 Posted September 8, 2010 Author Share Posted September 8, 2010 Yes got it working mysql_query("INSERT INTO ".PREFIX."cup_matches ($type, matchno, clan1, clan2, comment, 1on1) ( SELECT a.$type, a.matchno, a.clan1, b.clan2, a.comment, a.1on1 FROM ".PREFIX."cup_matches a, ".PREFIX."cup_matches b WHERE a.clan2 != b.clan2 AND a.matchno = '1' AND b.matchno = '1' AND a.ladID='b' AND b.ladID='b')") Thank you VERY much for all the help!! Quote Link to comment Share on other sites More sharing options...
mikosiko Posted September 8, 2010 Share Posted September 8, 2010 good... glad to help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.