Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7070583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:35:03+00:00 2026-05-28T05:35:03+00:00

I learned that using field in (a1,a2,a3) is comparably faster than using = operator.

  • 0

I learned that using field in (a1,a2,a3) is comparably faster than using = operator.

SELECT *
FROM user
WHERE Greeting IN ('hello', 'hi', 'hey')

How can I write above query in rails way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:35:03+00:00Added an answer on May 28, 2026 at 5:35 am

    You’d do something like this:

    users = User.where('greeting in (?)', %w{hello hi hey})
    

    Rails will know what to do with an array, %w{hello hi hey}, as a value for a placeholder. Or, if you already had an array of strings:

    h_words = [ 'hello', 'hi', 'hey' ]
    users   = User.where('greeting in (?)', h_words)
    # or even this
    users   = User.where('greeting in (:words)', :words => h_words)
    

    or, probably the most Railsy way, like this:

    users = User.where(:greeting => %w{hello hi hey})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I learned that using a reference variable is faster than using $() every line
I recently learned that when using onclick, for a button, the field name and
I learned that by trying to use the tablesorter plug in from jquery the
I've learned that MySQL can compress communication between servers and clients. Compression is used
In OO Javascript constructor pattern: neo-classical vs prototypal , I learned that constructors using
Somehow or the other, I learned that I can simply pass in parameters into
Recently I've learned that setting the charset using the meta tag is a pretty
I am programming cross-platform apps via PhoneGap and I learned that using template engines
I am using DelphiIXE. I learned that GlobalMemoryStatus may return wrong results on 64
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.