I have 2 tables that I am trying to compare prices with:
table2000
-->id
-->item
-->price
table2003
-->id
-->item
-->price
I want to see what differences there are with the 2 tables. I would like to step through the records in 'table2000' and for each 'item', find a similar 'item' in 'table2003'. Is there a simpler way than the PHP code shown below to run the MySQL query? Could this be handled in a single SQL statement on a 3.23.55 MySQL server?
print ("ITEM - 2000 Price :: 2003 Price<br>"
$Query="SELECT * FROM table2000";
$Result=mysql_db_query (mydatabase, $Query, mysql_connect (localhost,root,''));
while ($Row=mysql_fetch_array ($Result)){
$SubQuery="SELECT * FROM table2003 WHERE table2003.item=$Row[item]";
$SubResult=mysql_db_query (mydatabase, $SubQuery, mysql_connect (localhost,root,''));
while ($SubRow=mysql_fetch_array ($SubResult)){
print ("$Row[item] - $Row[price] :: $SubRow[price]<br>"
}
}
- - picklefish - -
Why is everyone in this forum responding to me as picklefish?
table2000
-->id
-->item
-->price
table2003
-->id
-->item
-->price
I want to see what differences there are with the 2 tables. I would like to step through the records in 'table2000' and for each 'item', find a similar 'item' in 'table2003'. Is there a simpler way than the PHP code shown below to run the MySQL query? Could this be handled in a single SQL statement on a 3.23.55 MySQL server?
print ("ITEM - 2000 Price :: 2003 Price<br>"
$Query="SELECT * FROM table2000";
$Result=mysql_db_query (mydatabase, $Query, mysql_connect (localhost,root,''));
while ($Row=mysql_fetch_array ($Result)){
$SubQuery="SELECT * FROM table2003 WHERE table2003.item=$Row[item]";
$SubResult=mysql_db_query (mydatabase, $SubQuery, mysql_connect (localhost,root,''));
while ($SubRow=mysql_fetch_array ($SubResult)){
print ("$Row[item] - $Row[price] :: $SubRow[price]<br>"
}
}
- - picklefish - -
Why is everyone in this forum responding to me as picklefish?