Select b.barcode as barcode,sum(b.qty) as qty into outfile 'D:/backup/1.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' From trans a join transdetail b on a.transid=b.transid where a.businessdate= date_add(curdate(),interval -1 day) and a.transstatus=2 group by b.barcode这段代码运行在MYSQL上是可以导出CSV的,
我放到BAT中,就无法导出:
cd C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin"C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin\mysql" -uroot -ppassword blank -N -e "Select b.barcode as barcode,sum(b.qty) as qty into outfile 'D:/backup/1.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '""' LINES TERMINATED BY '\n' From trans a join transdetail b on a.transid=b.transid where a.businessdate= date_add(curdate(),interval -1 day) and a.transstatus=2 and b.itemstatus<>1 group by b.barcode"
我放到BAT中,就无法导出:
cd C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin"C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin\mysql" -uroot -ppassword blank -N -e "Select b.barcode as barcode,sum(b.qty) as qty into outfile 'D:/backup/1.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '""' LINES TERMINATED BY '\n' From trans a join transdetail b on a.transid=b.transid where a.businessdate= date_add(curdate(),interval -1 day) and a.transstatus=2 and b.itemstatus<>1 group by b.barcode"
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货