0
多熱膨脹係數,我有以下格式的SQL查詢:與阿雷爾
with from as (#{select * query}),
to as (#{another select *}),
rates as (#{yet another select *})
select rates.* from rates, from, to
where rates.from_id = from.id and rates.to_id = to.id
我怎樣才能將它轉換爲阿雷爾?我研究了Arel CTE,但是沒有使用上面查詢中的多個別名的例子。
如果您的用例支持它,您可以考慮使用視圖。甚至有一個[圖書館可以像Thoughtbot的模型一樣處理視圖](https://github.com/thoughtbot/scenic)。 – coreyward