3
回答
Mysql中的sql语句
注册华为云得mate10,2.9折抢先购!>>>   

在mysql的插入操作中,insert table values ();

当中values可以不写么?下面是我项目中一个别人写的sql,这个sql中就没有values这个关键字,也能执行。。。

请各位大神指教下:

insert into t_bill_invests (user_id,invest_id,bid_id,mer_bill_no,periods,title,receive_time,receive_corpus,receive_interest, status, overdue_fine, real_receive_corpus, real_receive_interest) 

SELECT a.user_id,a.id, a.bid_id,a.mer_bill_no,b.periods,b.title,b.repayment_time,truncate(((a.amount * b.repayment_corpus)/ c.amount),2),
  truncate(((a.amount * b.repayment_interest)/ c.amount),2), -1, 0.00, 0.00, 0.00 
FROM t_bills AS b LEFT JOIN t_invests AS a ON a.bid_id 
  = b.bid_id LEFT JOIN t_bids AS c ON a.bid_id = c.id AND b.bid_id = c.id 
WHERE b.bid_id IS NOT NULL AND b.status 
  = -1 AND b.bid_id = ?";

<无标签>
举报
hf201429
发帖于2年前 3回/134阅
顶部