我一直在阅读这个查询现在约20分钟,我看不出它有什么问题。MySQL错误,未知原因
SELECT SQL_CALC_FOUND_ROWS addressbook_people.first_name,
addressbook_people.last_name ,
addressbook_people.preferred_name ,
addressbook_companies3.name ,
addressbook_people.url ,
addressbook_groups5.name ,
addressbook_people.telephone1 ,
addressbook_people.telephone2 ,
addressbook_people.telephone3 ,
addressbook_people.email1 ,
addressbook_people.email2 ,
addressbook_people.fax1 ,
addressbook_people.fax2 ,
root_countries13.name ,
root_territories14.name ,
root_cities15.name ,
addressbook_people.address1 ,
addressbook_people.zip_postal1 ,
addressbook_people.po_box ,
root_countries19.name ,
root_territories20.name ,
root_cities21.name ,
addressbook_people.address2 ,
addressbook_people.zip_postal2
FROM addressbook_people
WHERE (
(
addressbook_people.first_name LIKE '%a%'
OR addressbook_people.last_name LIKE '%a%'
OR addressbook_people.preferred_name LIKE '%a%'
OR addressbook_companies3.name LIKE '%a%'
OR addressbook_people.url LIKE '%a%'
OR addressbook_groups5.name LIKE '%a%'
OR addressbook_people.telephone1 LIKE '%a%'
OR addressbook_people.telephone2 LIKE '%a%'
OR addressbook_people.telephone3 LIKE '%a%'
OR addressbook_people.email1 LIKE '%a%'
OR addressbook_people.email2 LIKE '%a%'
OR addressbook_people.fax1 LIKE '%a%'
OR addressbook_people.fax2 LIKE '%a%'
OR root_countries13.name LIKE '%a%'
OR root_territories14.name LIKE '%a%'
OR root_cities15.name LIKE '%a%'
OR addressbook_people.address1 LIKE '%a%'
OR addressbook_people.zip_postal1 LIKE '%a%'
OR addressbook_people.po_box LIKE '%a%'
OR root_countries19.name LIKE '%a%'
OR root_territories20.name LIKE '%a%'
OR root_cities21.name LIKE '%a%'
OR addressbook_people.address2 LIKE '%a%'
OR addressbook_people.zip_postal2 LIKE '%a%'
)
)
LEFT JOIN addressbook_companies AS addressbook_companies3
ON addressbook_people.company_id = addressbook_companies3.id
LEFT JOIN addressbook_groups AS addressbook_groups5
ON addressbook_people.group_id = addressbook_groups5.id
LEFT JOIN root_countries AS root_countries13
ON addressbook_people.country1 = root_countries13.id
LEFT JOIN root_territories AS root_territories14
ON addressbook_people.territory1 = root_territories14.id
LEFT JOIN root_cities AS root_cities15
ON addressbook_people.city1 = root_cities15.id
LEFT JOIN root_countries AS root_countries19
ON addressbook_people.country2 = root_countries19.id
LEFT JOIN root_territories AS root_territories20
ON addressbook_people.territory2 = root_territories20.id
LEFT JOIN root_cities AS root_cities21
ON addressbook_people.city2 = root_cities21.id
ORDER BY LTRIM(addressbook_people.url)DESC
LIMIT 0, 10
这是我的数据表过滤器的输出。所以忽略了我正在寻找像“一”
我使用phpMyAdmin,通过Web管理控制台执行的查询的SQL时,我收到以下错误
1064的事实 - 你有一个您的SQL语法错误;检查
对应于你的MySQL服务器版本正确的语法使用 附近的线54
我检查了线“LEFT JOIN addressbook_companies AS addressbook_companies3 ON 地址”的手册,它是我加入的开始。我没有看到问题..有人可以帮忙吗?我从来没有用过SQL。
没有或许在Web管理控制台中的查询长度的限制,不是吗?这是一个很长的查询。 –
我想看看这个查询需要多少时间在1.000.000行的表上执行,这并不是那么多:) – mkk
它实际上并没有那么糟糕。现在我有6000行,它在几分之一秒内执行。它是ajax结果过滤的一部分。我看到很少的延迟,所以我没有实际测试过它。 – rlemon