+ -
当前位置:首页 → 问答吧 → 这样子SQL查询没有值

这样子SQL查询没有值

时间:2011-06-30

来源:互联网

sqlPt="select * from Product where class1Id in (select replace(biaoid,'a',',') from classid where classId="&classId&") order by id desc"

这样子查询没有值,
但是我直接select replace(biaoid,'a',',') from classid where classId="&classId&" 先查询出来,1,7,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,4
然后在:select * from Product where class1Id in (1,7,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,4) order by id desc
这样又有值?

作者: ren0594   发布时间: 2011-06-30

sqlPt="select * from Product where class1Id in (select replace(biaoid,'a',',') as col from classid as t where classId="&classId&") order by id desc"

没有理由的,给子查询的对象加上别名试试

作者: aspwebchh   发布时间: 2011-06-30

sqlPt="select * from Product as p where class1Id in (select replace(biaoid,'a',',') as col from classid as t where t.classId="&classId&") order by id desc"

作者: aspwebchh   发布时间: 2011-06-30