gpt4 book ai didi

mysql - 我的mysql程序出了什么问题?

转载 作者:行者123 更新时间:2023-11-30 01:29:08 25 4
gpt4 key购买 nike

我在mysql中创建了一个程序,但我无法通过该程序选择任何内容,这是怎么回事?

delimiter //
create procedure getLineStasticFreightList(in start int(4),in row int(4),in stationIDD varchar(4),in dateStart datetime,in dateEnd datetime)
BEGIN
DROP VIEW IF EXISTS rqusg_lineStasticFreightUser;
CREATE VIEW rqusg_lineStasticFreightUser AS
SELECT a.id, c.stationName as station,b.name as track,sum(a.dddwTime) AS zgdddwsj, sum(a.ddzxTime) AS zgddzxsj, sum(a.zxzyTime) AS zgzxzysj, sum(a.ddzngyTime) AS zgddzngysj, sum(a.hcddqsTime) AS zgddqssj
FROM rqusg_line_yard a
join rqusg_line_tracks b
on a.track = b.id
join rqusg_line_stations c
on a.stationID = c.stationID
WHERE a.stationID = 'stationIDD' and a.arriveTime >= 'dateStart' and a.clczTime <= 'dateEnd'
group by a.track
union
select a.id,c.stationName as station,b.name as track,sum(a.dddwTime) as zgdddwsj,sum(a.ddzxTime) as zgddzxsj,sum(a.zxzyTime) as zgzxzysj,sum(a.ddzngyTime) as zgddzngysj,sum(a.hcddqsTime) as zgddqssj
from rqusg_line_yard a
join rqusg_line_tracks b
on a.track = b.id
join rqusg_line_stations c
on a.stationID = c.stationID
WHERE a.stationID = 'stationIDD' and a.arriveTime >= 'dateStart' and a.clczTime <= 'dateEnd'
group by a.track;
select * from rqusg_lineStasticFreightUser LIMIT start,row;
END
//

在我的程序中,我创建了一个 View 并从 View 中选择详细信息,但我无法选择任何内容。我认为参数有问题,但我不确定。有人可以帮助我吗?

最佳答案

您不应在参数变量两边加引号:

WHERE a.stationID = stationIDD and a.arriveTime >= dateStart  and a.clczTime <= dateEnd

顺便说一下,UNION 中的两个子查询是相同的。为什么相同的查询会出现两次?

关于mysql - 我的mysql程序出了什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17668007/

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