赞
踩
//两者区别在于,达梦若时间字段为关键字时需要加双引号(关键字,不加双引号字段名会变成大写,若大小写不敏感且非输出字段时可忽略)
SELECT * from continuousalarm where TO_DAYS( NOW( ) ) - TO_DAYS(时间字段) = 1
//时间字段为 Date
//mysql
TO_DAYS( NOW( ) ) - TO_DAYS(Date) = 1
//达梦
TO_DAYS( NOW( ) ) - TO_DAYS("Date") = 1
SELECT * from continuousalarm WHERE to_date("Date",'YYYY-MM-DD') = current_date - 1
参考 :https://blog.csdn.net/qq_32157851/article/details/88852386
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。