今天写MYSQL 当有个需求用到limit 在子查询下使用。郁闷了竟然过不去。但只要转化就就可以。真是悲剧。

update tbl

 set isoption=1 where  userguid='sss'  pid in(select pid from tbl  where activeid=1 and isoption=0  limit 3) 语法过不去 但是

update tblp set isoption1 where userguid='sss' and pid in(select t.pid from( select pid   from tblpromotion where activeid=1 and isoption=0  limit 3) as t )

就可以。所以不明白其内部是如何优化SQL语句的。

获取当天信息

SELECT count(1) as num FROM tblcdkey  WHERE  DATE_FORMAT(providetime,'%Y-%m-%d')=DATE_FORMAT(NOW(),'%Y-%m-%d')

比t-sql方便。

 

 

相关文章:

  • 2021-08-15
  • 2022-02-09
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2022-02-05
  • 2021-09-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
相关资源
相似解决方案