这是我的查询,我用于分页
SELECT DISTINCT email_list.*, email_counter.phone as e_phone,email_counter.email as e_email,email_counter.marketing as e_marketing
FROM Data_TLS_builders as email_list
LEFT JOIN wp_pato_email_list_counters as email_counter on email_counter.email_id = email_list.URN
LIMIT 120 OFFSET 150
而不是从120开始并在150结束,这应该显示30个结果,而mysql返回120结果并忽略OFFSET。我试过LIMIT 120,150
但仍然一样?
知道如何解决?
答案 0 :(得分:4)
form do |f|
inputs do
input :name
input :address
f.has_many :cars, heading: nil, allow_destroy: false, new_record: false do |a|
a.input :name
end
end
end
SELECT DISTINCT email_list.*, email_counter.phone as e_phone,email_counter.email as e_email,email_counter.marketing as e_marketing FROM Data_TLS_builders as email_list LEFT JOIN wp_pato_email_list_counters as email_counter on email_counter.email_id = email_list.URN LIMIT 30 OFFSET 120
指定记录数。
Limit
指定应跳过的记录数。
以上查询从121返回30条记录。
答案 1 :(得分:1)
LIMIT会告诉mysql你想要显示多少结果。 OFFSET会告诉mysql从哪里开始。
如果你想从120开始显示30个结果,它应该是: 限制30 OFFSET 120 要么 限制120,30