1

I have searched many places but found no result. I want to have a query like this:

SELECT * FROM( sub_query ) AS virtual_table

But it looks like Arel doesn't allow me to do so. Arel just allow some structure such as:

SELECT * FROM table_name as virtual_table

How can I overcome this limit in Arel.

Trần Kim Dự
  • 5,872
  • 12
  • 55
  • 107
  • http://stackoverflow.com/questions/2894807/nested-queries-in-arel – usha Dec 21 '16 at 19:42
  • @Vimsha thanks. but my problem is: nested query is not from any normal table. For example, I use `generate_series` for generate a table and then using for joining later. – Trần Kim Dự Dec 22 '16 at 02:11
  • I think Arel can do this, but this seems like a shoe-in for a [database view](https://github.com/thoughtbot/scenic), which would reduce complexity. – coreyward Jan 02 '17 at 19:31

0 Answers0