查看: 1023|回复: 3
|
这段sql statement有错吗?
[复制链接]
|
|
SELECT c.logo_link, c.name, c.webpage FROM
(SELECT * FROM company WHERE name LIKE '%cari%' UNION ALL
SELECT * FROM company WHERE category LIKE '%cari%' UNION ALL
SELECT * FROM company WHERE description LIKE '%cari%' UNION ALL
SELECT * FROM company WHERE specialist LIKE '%cari%' UNION ALL
SELECT * FROM company WHERE area LIKE '%cari%' UNION ALL
SELECT * FROM company WHERE webpage LIKE '%cari%' UNION ALL
SELECT * FROM company WHERE state LIKE '%cari%' UNION ALL
SELECT * FROM company WHERE address LIKE '%cari%' ) c
GROUP BY c.name, c.logo_link, c.webpage ORDER BY c.hits DESC
为何执行不到的?
You have an error in your SQL syntax near 'SELECT * FROM company WHERE name LIKE '%cari%' UNION ALL SELECT * FROM company' at line 2 |
|
|
|
|
|
|
|
发表于 26-8-2006 06:27 PM
|
显示全部楼层
尝试把 ALL 拿掉, 或这样写: UNION [all] |
|
|
|
|
|
|
|
楼主 |
发表于 27-8-2006 01:02 AM
|
显示全部楼层
两个都试过了。。。还是一样
想请问会不会关storage engine的事? 因为以前我是使用InnoDB,这段sql string是可以运行地,然而现在我是使用MyISAM...
为何我不试呢? 因为phpMyAdmin - 2.8.1-rc1没有InnoDB这个选项
以前用的phpMyAdmin - 2.7.1 基于一些原因我不能试 |
|
|
|
|
|
|
|
发表于 27-8-2006 11:55 AM
|
显示全部楼层
问题会不会出现在 LIKE '%' 那里 ?
不同类型的DBMS寻找不同data type的field的时候有不同quote 的用法, 和不同Logical Matching的用法. |
|
|
|
|
|
|
| |
本周最热论坛帖子
|