gpt4 book ai didi

MYSQL如何声明一个日期时间变量?

转载 作者:IT老高 更新时间:2023-10-29 00:11:20 24 4
gpt4 key购买 nike

我的代码:

DECLARE report_date DATETIME;
set report_date='2013-01-17 00:00:00';

SELECT *
FROM `NMPP`.`capacitypersecond`
WHERE `StreamDT` >=report_date and `StreamDT` < '2013-01-18 00:00:00' ;

SELECT *
FROM `NMPP`.`capacityperHr`
WHERE `StreamDT` >=report_date and `StreamDT` < '2013-01-18 00:00:00' ;

SELECT *
FROM `NMPP`.`capacityperDay`
WHERE `TJLDate` >=report_date and `TJLDate` < '2013-01-18 00:00:00' ;

-

DECLARE report_date DATETIME;
/* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECLARE report_date DATETIME' at line 1 */
/* Affected rows: 0 Found rows: 0 Warnings: 0 Duration for 0 of 5 queries: 0.000 sec. */

最佳答案

或与 Actor :

set @report_date = cast('2013-01-17 00:00:00' as datetime);

关于MYSQL如何声明一个日期时间变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14396196/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com