mysql 复合查询语句

INSERT INTO runwa(rshottime,rmoney,renamecount) VALUES (CURDATE(),(select SUM(MONEY)  from income where  CREATESHOTTIME = CURDATE()),(select count(distinct hostname) from income where  CREATESHOTTIME = CURDATE()));

 

1.查询某张表 一个字段的总和。(select SUM(MONEY) from income

2.MYSQL里当天的时间(CURDATE())

3.查询某张表某个字段不同的值的数量。(select count(distinct hostname) from income)

posted @ 2017-08-16 15:28  hellohyi  阅读(2241)  评论(0编辑  收藏  举报