Jump to content

Not sure how can do this? INSERT INTO()


karimali831

Recommended Posts

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

Link to comment
Share on other sites

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...

 

 

Link to comment
Share on other sites

Yes :D got it working ;);D::)

 

      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!!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.