赞
踩
//in子查询的写法 我自己的mysql支持 服务器不支持
(select user_no,videofile from user_info where phone in(SELECT caller from pair_info where receiver='1365555' and invite_flag=1 and read_flag=0 ) and phone not in(SELECT receiver from pair_info where caller='1365555'and receive_invite_flag=2 and createtime>=now()) and status=1 and top_flag=1 and valid_top_datetime>now() order by lastupdatetime desc) union (select user_no,videofile from user_info where phone in(SELECT caller from pair_info where receiver='1365555' and invite_flag=1 and read_flag=0 ) and phone not in(SELECT receiver from pair_info where caller='1365555' and receive_invite_flag=2 and createtime>=now()) and status=1 and top_flag=0 order by lastupdatetime desc)
//不支持in 看看 any行不,还是不行
(select user_no,videofile from user_info where phone = any (SELECT caller from pair_info where receiver='1365555' and invite_flag=1 and read_flag=0 ) and phone != any (SELECT receiver from pair_info where caller='1365555' and receive_invite_flag=2 and createtime>=now()) and status=1 and top_flag=1 and valid_top_datetime>now() order by lastupdatetime desc) union (select user_no,videofile from user_info where phone = any(SELECT caller from pair_info where receiver='1365555' and invite_flag=1 and read_flag=0 ) and phone != any(SELECT receiver from pair_info where caller='1365555' and receive_invite_flag=2
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。