1 回答
TA贡献1836条经验 获得超4个赞
and (c.customers_lastname like '%adolfs%'
or c.customers_firstname like '%adolfs%'
or c.customers_email_address like '%adolfs%'
or a.entry_company like '%adolfs%' or c.customers_id = 'adolfs')
这些应该在 where 子句中,而不是您加入的一部分
select
c.customers_id, c.customers_firstname, c.customers_lastname,
c.customers_email_address, c.customers_account_validated,
c.customers_payment_period, a.entry_country_id, a.entry_company
from customers c
left join address_book a on c.customers_id = a.customers_id
and c.customers_default_address_id = a.address_book_id
where c.customers_lastname like '%adolfs%'
or c.customers_firstname like '%adolfs%'
or c.customers_email_address like '%adolfs%'
or a.entry_company like '%adolfs%'
or c.customers_id = 'adolfs')
group by c.customers_id
order by c.customers_id DESC
那应该工作
- 1 回答
- 0 关注
- 117 浏览
添加回答
举报