今天碰到mysql 5.0转移到 mysql 3.24上出现的sql语句错误
sql 代码
- select * from sort where id in (select id from sort where fid=10)
原以为不支持in,
改用exists
sql 代码
- select * from sort as s where exists (select id from sort where fid=10 and id=s.id)
还是错误
最终发现是不支持 select 结果集作为新的操作集用
ps:应该是4.0才支持子集合
最后只好改为内连接的方法
sql 代码
- select a.title,a.id from article_text as a inner join sort as s on a.sort_id = s.id where s.fid=10 and a.isIndex order by a.id desc limit 20
- select * from bar_tie as t inner join ( bar_bar as b inner join bar_sort as s ) on (t.bar_id=b.id and b.sort_id=s.id ) where s.fid in (2)