将子查询转化成连表查询有关问题
程序员文章站
2022-04-30 10:49:46
...
将子查询转化成连表查询问题
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
该子查询如何改为连表查询
------解决思路----------------------
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
该子查询如何改为连表查询
------解决思路----------------------
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
相关文章
相关视频
上一篇: 从数据库中读取字符串时其中的空格变成加号
下一篇: python简单读取大文件