(select u._netName from t_gw_netuser u where u._netName = a._uid) _netName,
(select w._urlName from t_gw_websiteurl w where w._urlId = w._url) _urlName,
count(distinct a._url) CUrl,
count(a._host) CHost,
sum(a._count) SCount,
SUl,
SDl,
a._logtime
from t_gw_merge_log a join
(select sum(p._ul) SUl,sum(p._dl) SDl,p._appId from t_gw_applog p group by p._appId) x on a._app=x._appId
group by a._uid,a._url
order by _urlName
考虑下这个SQL
Mysql中在用连接查询的时候,若两个表的连接字段名完全相同,则可以使用join using来简化join on
格式:
例:
简化前
简化后
SELECT b_id,count(*) as count FROM bro_case WHERE group by b_id having b_id in(46,47,48,49,50,51,52,53,54,55,56,57,58,26,106)欢迎分享,转载请注明来源:内存溢出
评论列表(0条)