Answer the question
In order to leave comments, you need to log in
RAILS result from multiple requests?
Hello. Tell me please. The database used is PostgreSQL. For optimization purposes, I decided to combine several queries into one, how to get results from all queries, otherwise it returns only from the last one. Thank you.
sql = "SELECT number FROM institution_orders WHERE institution_id = 980190990 ORDER BY id DESC LIMIT 1;" +
"select prefix from institutions where id = 980190990 limit 1"
record = JSON.parse( ActiveRecord::Base.connection.execute( sql ).to_json, symbolize_name: true )
# [{"prefix"=>"KL"}]
Answer the question
In order to leave comments, you need to log in
I think you are doing something crazy.
The first stage of optimization is measurements .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question