Hi,
I am comparing my update table to the latest data in in my main
data table, so I am selecting the latest data from the main table with this expression:
mday_no is an indexed column.
However, I realized that I could also do this and I assume I would get the same result.
Is one method more efficient that the other?
I am comparing my update table to the latest data in in my main
data table, so I am selecting the latest data from the main table with this expression:
mday_no is an indexed column.
Code:
$sql_main = "SELECT * FROM cb_main WHERE mid = '$the_id' AND mday_no=(select max(mday_no)";
$result_main = mysql_query($sql_main)
or die("could not FIND ID in cb_main.". mysql_error());
Code:
$sql_main = "SELECT * FROM cb_main WHERE mid = '$the_id' ORDER BY mday_no DESC limit 1";
$result_main = mysql_query($sql_main)
or die("could not FIND ID in cb_main.". mysql_error());
Comment