LoginSignup
0
0

More than 5 years have passed since last update.

Ruby on Railsを使ってクエリを直に書く

Posted at

環境

  • CentOS6.5
  • Rails 5.1.4
  • MySQL 5.7

RailsでMySQLのテーブル作成で作成したテーブルを使います。

users = User.find_by_sql(['ここにクエリを書く'])

例:

users = User.find_by_sql(['SELECT id, name FROM users WHERE id BETWEEN ? AND ?', 10, 30])
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0