How to run raw SQL queries with Sequel
问题 I am not clear yet on the proper way to run raw SQL queries with Sequel. Currently I am trying this: DB.fetch("SELECT * FROM zone WHERE dialcode = '#{@dialcode}' LIMIT 1") do |row| @zonename = row end How can I can run the queries as raw SQL then access the results like normal? if @zonename.name = "UK" 回答1: I have a few pointers which may be useful: You could simply do: @zonename = DB.fetch("SELECT * FROM zone WHERE dialcode = ? LIMIT 1", @dialcode).first NB: you are ignoring the fact that