我在<TextBox Text="{Binding Path=(local:WrapperClass.Filter), Mode=TwoWay}" />
中添加例程时遇到错误我尝试在添加例程中添加代码然后在下面给出的整个代码中收到错误。
我的存储过程代码是:
phpmyadmin.whenever
我在这里使用两个表,表格的结构如下。 1交易2. outlet
BEGIN
SET @LocationType = _locationType;
SET @LocationId = _locationId;
SET @LocationMaster = _locationMaster;
SET @CategoryId = _categoryId;
SET @SELECTQUERY = " select SalesChannel.name , Transaction.category_id, count(Transaction.category_id) as count from outlets Outlet inner join transactions Transaction on Outlet.id = Transaction.outlet_id inner join sale_channels SalesChannel on SalesChannel.id = Outlet.sale_channel_id ";
SET @WHEREQUERY = " WHERE TRUE = TRUE ";
SET @GROUPBY = "";
IF @LocationType is NOT NULL AND @LocationType != '' AND @LocationType == 'zone' THEN
SET @WHEREQUERY = CONCAT(@WHEREQUERY, ' AND Outlet.zone_id = @LocationId ');
END IF;
IF @LocationType is NOT NULL AND @LocationType != '' AND @LocationType == 'state' THEN
SET @WHEREQUERY = CONCAT(@WHEREQUERY, ' AND Outlet.state_id = @LocationId ');
END IF;
IF @LocationType is NOT NULL AND @LocationType != '' AND @LocationType == 'city' THEN
SET @WHEREQUERY = CONCAT(@WHEREQUERY, ' AND Outlet.city_id = @LocationId ');
END IF;
IF @LocationMaster is NOT NULL AND @LocationMaster != '' AND @LocationMaster == 'zone' THEN
SET @WHEREQUERY = CONCAT(@WHEREQUERY, ' AND Outlet.zone_id = @LocationId ');
END IF;
IF @CategoryId is NOT NULL AND @CategoryId != '' THEN
SET @WHEREQUERY = CONCAT(@WHEREQUERY, ' AND Transaction.category_id = @CategoryId ');
END IF;
SET @GROUPBY = CONCAT(@GROUPBY, ' GROUP BY Transaction.category_id');
SET @SQLQUERY = CONCAT(@SELECTQUERY , @WHEREQUERY, @GROUPBY);
PREPARE state1 FROM @SQLQUERY;
EXECUTE state1;
END