mysql-MYSQL语句优化,在线等

php中文网
发布: 2016-06-06 09:40:41
原创
1416人浏览过
mysql

select tt.int_interpreting_data_id,tt.dt_report_date,tn.str_norm_number,tnt.str_norm_type_name,tt.int_whether,tt.str_value,tt.str_detection_result,tt.str_remark,tn.str_name,tn.int_response_type,tt.str_device_name,tt.str_ip,tt.db_name,tn.str_code
from t_norm tn left join
(
select tid1.str_code,tid1.int_interpreting_data_id,tid1.dt_report_date,tid1.str_norm_type_name,tid1.int_whether,tid1.str_value,tid1.str_detection_result,tid1.str_remark,tid1.str_device_name,tid1.str_ip,tid1.db_name,tid1.str_norm_number from t_interpreting_data tid1,
(
select str_code,int_interpreting_data_id,str_norm_type_name,int_whether,str_value,str_detection_result,str_remark,str_device_name,str_ip,db_name,str_norm_number,max(dt_report_date) max_date from t_interpreting_data where 1=1
and str_property_id='windows 7_852'
and str_to_date(dt_report_date,'%y-%m-%d') ='2015-06-05'
group by str_norm_number,db_name
) tid2
where tid1.dt_report_date=tid2.max_date
group by tid1.str_norm_number,tid1.db_name
order by tid1.dt_report_date desc
) tt on tn.str_norm_number=tt.str_norm_number
left join t_norm_type tnt on tn.int_norm_type_id=tnt.int_norm_type_id
where tn.str_code in (select str_code from t_interpreting_data where str_property_id='windows 7_852' group by str_code)
order by tt.str_norm_number desc

1.以t_norm表为标准
2.查找 t_interpreting_data表中同一个类型最新的记录,同时根据db_name分组

SmartB2B行业电子商务
SmartB2B行业电子商务

SmartB2B 是一款基于PHP、MySQL、Smarty的B2B行业电子商务网站管理系统,系统提供了供求模型、企业模型、产品模型、人才招聘模型、资讯模型等模块,适用于想在行业里取得领先地位的企业快速假设B2B网站,可以运行于Linux与Windows等多重服务器环境,安装方便,使用灵活。 系统使用当前流行的PHP语言开发,以MySQL为数据库,采用B/S架构,MVC模式开发。融入了模型化、模板

SmartB2B行业电子商务 0
查看详情 SmartB2B行业电子商务
相关标签:
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号