工作需要,写按sensor_uuid在某范围查询的语句:

1.select * from xz_sensor_data where sensor_time>='2019-03-28 00:00:00.000' and sensor_time<='2019-03-28 08:00:00.000' and sensor_uuid in('20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','201901','201902','201903','201904','201905','201906','201907','201908','201909','201910','201911','201912','201913')  order by sensor_time asc

mysql条件查询语句between and和in的效率比较

2.select * from xz_sensor_data where sensor_time>='2019-03-28 00:00:00.000' and sensor_time<='2019-03-28 08:00:00.000' and (sensor_uuid  between '19' and '36' or sensor_uuid between '201900' and '201914' )

mysql条件查询语句between and和in的效率比较

发现第二条执行效率高。

相关文章:

  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
  • 2021-08-23
  • 2022-12-23
  • 2022-02-18
  • 2021-05-10
  • 2021-10-09
猜你喜欢
  • 2021-08-18
  • 2022-12-23
  • 2022-02-12
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
相关资源
相似解决方案