1、如何為字段自動生成序號
set @inc=0;
update talbe set bh=@inc:=@inc+1;
2、如何獲得符合條件數(shù)據(jù)總數(shù)
利用found_rows()函數(shù)
首先執(zhí)行 select sql_calc_found_rows * from table where id>1 limit 10;
然后執(zhí)行查詢 select found_rows();
這樣既能獲得前10條數(shù)據(jù),又能獲得總記錄數(shù)