Home >Database >Mysql Tutorial >mysql-急急急,求sql大神帮忙解决

mysql-急急急,求sql大神帮忙解决

WBOY
WBOYOriginal
2016-06-06 09:34:52985browse

mysqlgps数据sql

各位大神们,现在有两张表realtime(send_time,range,oil)和gps(send_time,speed),我要把这两张表的数据汇总到sum表中,sum表的字段有year,month,day,hour,max(range)-min(range),avg(oil),max(speed),avg(speed),sum表记录的是每小时的数据,年月日小时就是send_time里面的,前两张表是每10秒的数据,他们每条数据都是一一对应的,sum表用的是是组合主键,有年月日小时这4个主键,我用的mysql,达到这一操作的sql语句要怎么写啊,我之前想写成一条,总写不好,后来分2条写,第二个update语句又不知道怎么写了,谢谢帮助我的各位大神

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn