我想在select语句中定义一些变量。例如,这里我想定义出价,询问作为表中存储的原始值的修改值(此代码不起作用):
select ts,ticker,bid:(bid1_price*1e-4),ask:(sl1_price*1e-4),wt:((next ts) - ts),spread:(ask - bid),wtspread:(((next ts) - ts) wavg (ask - bid)) from md where...
如何在select语句中定义变量?
答案 0 :(得分:2)
首先创建出价并询问列,然后在更新中使用它们
update wt:((next ts) - ts), spread:(ask - bid), wtspread:(((next ts) - ts) wavg (ask - bid)) by date from select ts, ticker, bid:(bid1_price*1e-4), ask:(sl1_price*1e-4) from md where...