I am having trouble cross computing and inserting the results from 2 different tables into another one,
table structure
2_o contains 210 results
4_e contains 5985 results
all_combinations should theoretically contain after cross computing the results 210 * 5985 = 1,256,850 results
my query is working thus my only problem is that its not reaching the result that it should 1,256,850 and it seems that its not finishing and cutting every time on a different total. no idea why. 1,247,102 or 1,153,550 etc...
<?php
$sql = mysql_connect("localhost", "root", "mysql");
if (!$sql) {
die("Could not connect: " . mysql_error());
}
mysql_select_db("numbers");
$result = mysql_query("INSERT INTO all_combinations (o1,o2,e1,e2,e3,e4) SELECT n2.o1, n2.o2, n4.e1, n4.e2, n4.e3, n4.e4 FROM 2_o AS n2, 4_e AS n4");
echo "done";
if (!$result) {
die("Could not input results. " . mysql_error());
}
?>