我有以下用于创建 MySQL 视图的语法:
create view `ViewName` as (select
v_starting.callingname,
v_starting.geofence,
v_starting.`updatetime`,
@lastGroup := @lastGroup + if( @lastAddress = v_starting.geofence
AND @lastVehicle = v_starting.callingname, 0, 1 ) as GroupSeq,
@lastVehicle := v_starting.callingname as justVarVehicleChange,
@lastAddress := v_starting.geofence as justVarAddressChange
from
v_starting,
( select @lastVehicle := '',
@lastAddress := '',
@lastGroup := 0 ) SQLVars
order by
v_starting.`updatetime` )
这失败并出现错误:
#1351 - View's SELECT contains a variable or parameter
我怎样才能解决这个问题?太感谢了。