Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. sql = "#select count(1)
  2. select f.id, fcp.price, fcp.wholesale_price, fc.name, ct.id, f.number
  3. from fabric_collections fc
  4. inner join fabric_collection_prices fcp on fc.id = fcp.fabric_collection_id
  5. inner join clothes_types ct on fcp.clothes_type_id = ct.id
  6. inner join fabric_fabric_collections ffc on fc.id = ffc.fabric_collection_id
  7. inner join fabrics f on f.id = ffc.fabric_id
  8. where (fc.id in (#{fabric_collection_ids.join(', ')})) and (fcp.currency_id = #{currency_id})
  9. order by f.id, ct.id"
  10. result_lines = ActiveRecord::Base.connection.execute(sql)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement