0

我正在尝试执行查询,但我不知道在不使用存储过程的情况下让它工作,但由于我使用的编程语言的限制,它的 mysql 平台不会接受存储过程/函数。

代码是:

select
    (myrpg_faction_info.funds) as bank,
    (
        myrpg_faction_info.paycheckrate +
        myrpg_faction_ranks.paycheckrate +
        sum(myrpg_faction_flags.paycheckrate)
    ) as rate

from 
    myrpg_faction_info
inner join
    myrpg_faction_ranks 
        on 
            myrpg_faction_info.id = myrpg_faction_ranks.fid and 
            myrpg_faction_ranks.rank=1
inner join
    myrpg_faction_flags 
        on 
            myrpg_faction_info.id=myrpg_faction_flags.fid and
            (1 << myrpg_faction_flags.flag) & 1
where myrpg_faction_info.id=1

但我必须保存汇率和银行变量(在 SQL 中)并更新 faction_info 表以从 faction_info.bank 列中取出汇率并选择取出的值,但我不知道该怎么做。

4

1 回答 1

0
update mfi
set myrpg_faction_info.funds -
    (
        myrpg_faction_info.paycheckrate +
        myrpg_faction_ranks.paycheckrate +
        sum(myrpg_faction_flags.paycheckrate)
    ) as rate
from 
    myrpg_faction_info mfi
inner join
    myrpg_faction_ranks 
        on 
            myrpg_faction_info.id = myrpg_faction_ranks.fid and 
            myrpg_faction_ranks.rank=1
inner join
    myrpg_faction_flags 
        on 
            myrpg_faction_info.id=myrpg_faction_flags.fid and
            (1 << myrpg_faction_flags.flag) & 1
where myrpg_faction_info.id=1
于 2012-08-18T11:55:38.080 回答