当系统日期和日期(来自数据库)相等时,使用数据库中的触发器自动更改状态 [英] Change status automatically using trigger from database when system date and date(from database) are equal

查看:103
本文介绍了当系统日期和日期(来自数据库)相等时,使用数据库中的触发器自动更改状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当系统日期和日期(来自数据库)相等时,使用数据库中的触发器自动更改状态



我的表是 - :



员工



Id状态日期

1 false 2015-06-25

2假2015-06-25

3假2015-06-26

4假2015-06-26



如果系统日期为'2015-06-25',那么使用Id:1和2的触发状态将为true,如果系统日期为'2015-06-26',则它将状态false更改为true。

解决方案

对于MySQL,请按照这个



https://dev.mysql.com/doc/refman/5.1/en/events-overview.html [<一个href =https://dev.mysql.com/doc/refman/5.1/en/events-overview.html\"target =_ blanktitle =新窗口> ^ ]


http://www.sitepoint.com/how-to-create-mysql-events/ [ ^ ]



在这里查看mySQL

Change status automatically using trigger from database when system date and date(from database) are equal

My table is-:

Employee

Id Status Date
1 false 2015-06-25
2 false 2015-06-25
3 false 2015-06-26
4 false 2015-06-26

If system date will be '2015-06-25' then using trigger status of Id:1 and 2 will be true and if system date will be '2015-06-26' then it will change the status false to true.

解决方案

For MySQL , follow this

https://dev.mysql.com/doc/refman/5.1/en/events-overview.html[^]


http://www.sitepoint.com/how-to-create-mysql-events/[^]

see here for mySQL


这篇关于当系统日期和日期(来自数据库)相等时,使用数据库中的触发器自动更改状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆