select * from (select a.video_name name,a.vid,a.pos,a.pic,a.definition,b.app_code,a.strength,a.ad_mark from access_app_video a
left join access_app b on a.app_id=b.id where tag_interest=2 and app_id=1 and a.ad_mark=1 and a.status=0 order by abs(tag_sex-16),abs(tag_figure-10)) aa
order by aa.strength desc limit 0,12
该子查询如何改为连表查询
主页面上引用了三个页面也说不过去呀。本次主要是把数据库合并了一下,至于功能,没有加什么新的东西,还是那些:在线订购、帐单查询(添加了一个打印的连接)、特价商品列表、热买商品列表、留言本(许多朋友说以前的那个有问题,现在换成枫叶阁女士留言本,挺不错的)、新闻、完善的管理
4
SELECT a.video_name NAME,a.vid,a.pos,a.pic,a.definition,b.app_code,a.strength,a.ad_mark FROM access_app_video a LEFT JOIN access_app b ON a.app_id=b.id WHERE tag_interest=2 AND app_id=1 AND a.ad_mark=1 AND a.status=0 ORDER BY a.strength, ABS(tag_sex-16),ABS(tag_figure-10) DESC LIMIT 0,12
感谢2楼回答,但是这样写,搜索出的结果和原结果是不同的,原sql的意思是先按照ABS(tag_sex-16),ABS(tag_figure-10)排序
之后再根据a.strength排序,2楼给的sql改变了排序规则。。
#2
最终的结果是按 a.strength 降序,当 a.strength 相同时 按 ABS(tag_sex-16),ABS(tag_figure-10) 升序
当然,当 ABS(tag_sex-16),ABS(tag_figure-10) 有多组相同值的时候,结果会略有不同
这也就是作者那样写的原因吧
5
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号