我想将BalanceAmount
设置为变量但它返回一个空值。
Declare BalAmt as int;
SET BalAmt = (SELECT BalanceAmount FROM mstragentrecharge);
SELECT BalAmt
答案 0 :(得分:0)
如果此代码来自功能或程序,请尝试以下
Declare BalAmt as int;
SELECT BalanceAmount into BalAmt FROM mstragentrecharge);
SELECT BalAmt
或者,对于简单查询:
SET @BalAmt := '';
SELECT @BalAmt := `BalanceAmount ` FROM mstragentrecharge limit 1;
SELECT @BalAmt FROM mstragentrecharge;