×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: SQL
Posted by: Denis Dotsenko
Added: Jun 26, 2017 10:41 AM
Modified: Jul 28, 2017 2:43 PM
Views: 6
Tags: sql
SQL query for several tables
  1.     find_by_sql("SELECT orders.* FROM orders
  2.                   JOIN order_items oi
  3.                   ON orders.id = oi.order_id JOIN users
  4.                   ON oi.user_id = users.id
  5.                   WHERE users.id = #{user.id}
  6.                   LIMIT 1")