RajG
RajG

Reputation: 832

how to implement and, or clauses in sql queries? ruby on rails

I tried looking around but could not find an answer on how to implement the combination of AND, |(or). I am getting an error. The code is listed below:

allgames = GameInfo.Get.where(["list = ? AND (lang = ? OR lang = ?)", "yes", "en", @lang]).order(:order)

The error I am getting is below:

The specified query expression syntax is not valid.

please shed some light,

Regards,

Upvotes: 0

Views: 81

Answers (1)

Matzi
Matzi

Reputation: 13925

Pipe is not used in sql:

where("list = ? AND (lang = ? OR lang = ?)", "yes", 'en',@lang)

Upvotes: 1

Related Questions