使用 Sequel gem:
employees = DB[:prm_master__employee.identifier]
.join(:prm_master__employee_custom_fields.identifier, :employee => :employee)
.where("termination_date >= ?","06/01/2012")
.or("termination_date = NULL")
.and("employee = 'holderl'")
以上失败:
~/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/sequel-3.41.0/lib/sequel/adapters/tinytds.rb:221:in `fields': TinyTds::Error: Ambiguous column name 'employee'. (Sequel::DatabaseError)
我理解错误(连接表之间的列名相同,例如员工),但不知道如何限定and
语句中的员工条件,因为表使用标识符方法忽略下划线。