首页 >后端开发 >php教程 >修改MYSQL语句,多谢

修改MYSQL语句,多谢

WBOY
WBOY原创
2016-06-13 10:09:281041浏览

修改MYSQL语句,谢谢~
select * from (select * from city where names like '%xxx%' limit 10) where names like '$xxx%' order by names

错误提示:Every derived table must have its own alias

应该怎么改呀?

------解决方案--------------------
select * from (select * from city where names like '%xxx%' limit 10) where names like '$xxx%' order by names
分析下:
select * from (table)这个table要是一个表
select * from city where names like '%xxx%' limit 10这个很明显不符合,差了很远

所以你那句很明显是错误的
------解决方案--------------------
我没去验证()里面放limit可不可以哈 但根据错误提示应该是这个意思

select * from (select * from city where names like '%xxx%' limit 10) t where names like '$xxx%' order by names
------解决方案--------------------

探讨
我没去验证()里面放limit可不可以哈 但根据错误提示应该是这个意思

select * from (select * from city where names like '%xxx%' limit 10) t where names like '$xxx%' order by names
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn