0

我需要执行多个表移动,我这样做是这样的:

$result = mysql_query("INSERT INTO `fiscal_rad_test` (`objectid`, `dan`, `smena`, `racun`, `owner`, `konobar`, `sto`, `tip`, `konto`, `datum`, `vreme`, `tiprobe`, `roba`, `naziv`, `kolicina`, `cena`, `ukupno`, `nabavna`, `stanje`, `porez`, `kategorija`)
    SELECT `objectid`,
           `dan`,
           `smena`,
           `racun`,
           `owner`,
           `konobar`,
           `sto`,
           `tip`,
           `konto`,
           `datum`,
           `vreme`,
           `tiprobe`,
           `roba`,
           `naziv`,
           `kolicina`,
           `cena`,
           `ukupno`,
           `nabavna`,
           `stanje`,
           `porez`,
           `kategorija`
    FROM `fiscal_rad_temp_test`
    WHERE objectid = '$object'");   
$transacitionresult = mysql_query("INSERT INTO `fiscal_transactions` (`objectid`, `dan`, `smena`, `owner`, `konobar`, `sto`, `tip`, `konto`, `datum`, `vreme`, `racun`, `data`, `ukupno`)
    SELECT `objectid`,
           `dan`,
           `smena`,
           `owner`,
           `konobar`,
           `sto`,
           `tip`,
           `konto`,
           `datum`,
           `vreme`,
           `racun`,
           `data`,
           `ukupno`
    FROM `fiscal_transactions_temp`
    WHERE objectid = '$object'");
$delete = mysql_query("DELETE FROM `fiscal_transactions_temp` WHERE objectid = '$object'");
$delete = mysql_query("DELETE FROM `fiscal_rad_temp_test` WHERE objectid = '$object'");

这是更好,更可靠的方法吗?我可以排除一些错误,也许有些行没有用这种方法删除吗?

4

0 回答 0