ray Posted December 18, 2007 Report Share Posted December 18, 2007 (edited) Kāda būtu pēc iespējas labāka, ātrāka un efektīvāka metode, ja man ir tabulas tabula_1, tabula_2, tabula_3, tabula_4 (visām tabulām struktūra identiska) un man vajag iegūt šādu rezultātu tabula_4 = tabula_3; (tabula_4 dati dzēšas un iegūst tabula_3 datus, tas pats efekts, ja tabula_3 pārsauktu par tabula_4) tabula_3 = tabula_2; tabula_2 = tabula_1; tabula_1 = truncate(tabula_1); Edited December 18, 2007 by ray Link to comment Share on other sites More sharing options...
betons Posted December 18, 2007 Report Share Posted December 18, 2007 (edited) Pārsauc tabulu http://dev.mysql.com/doc/refman/5.0/en/rename-table.html RENAME TABLE tabula_4 TO tmp_table, tabula_3 TO tabula_4, tabula_2 TO tabula_3, tabula_1 TO tabula_2, tmp_table TO tabula_1; DELETE * FROM tabula_1; Edited December 18, 2007 by betons Link to comment Share on other sites More sharing options...
Delfins Posted December 18, 2007 Report Share Posted December 18, 2007 drop(4) rename(3,4) rename(2,3) rename(1,2) create(1) Link to comment Share on other sites More sharing options...
ray Posted December 18, 2007 Author Report Share Posted December 18, 2007 par pārsaukšanu biju iedomājies, tikai domāju, ka varbūt ir kāda efektīvāka metode, jo šo izpildīs php skripts un vismaz reizi dienā. Link to comment Share on other sites More sharing options...
Delfins Posted December 18, 2007 Report Share Posted December 18, 2007 Vēl efektīvākas nepastāv... 1.) PHP var izsaukt SQL 2.) SQL var izsaukt no komandrindas batch-ā Link to comment Share on other sites More sharing options...
Recommended Posts