mysql子查询用法详解数据库

mysql子查询用法

1 可以当值来用


select id from hcyuyin_share where id=(select id from hcyuyin_share limit 200000,1)

2 可以当做表来用


select o.nickName,o.sex,o.province,o.city,from_unixtime(m.time,'%Y-%m-%d %H:%i:%s') as starttime,from_unixtime(z.time,'%Y-%m-%d %H:%i:%s') as endtime,ROUND((z.time-m.time)/60) as haoshifenzhong,from_unixtime(z1.time,'%Y-%m-%d') as choujiangtime from (select openid,time from xintjiashen_zhongjiang2 union select openid,time from xintjiashen_meizhong2) as z left join xintjiashen_my as m on z.openid=m.openid left join xintjiashen_zhongjiang1 as z1 on m.openid=z1.openid left join xintjiashen_oauthinfo as o on m.openid=o.wechatId where z1.prize_id !=8

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/4039.html

(0)
上一篇 2021年7月16日
下一篇 2021年7月16日

相关推荐

发表回复

登录后才能评论