sql子查询中表冲突问题
[ 2007-12-26 17:56:57 | 作者: admin ]
p.s. 当主查询和子查询使用的表相同,可以使用别名加以区别。
例如下面的例子
select a.*,b.classname as upClassname,
(select count(*) from fgnews c where upid= a.id) as downNum
from fgnews a ,fgnewsClass b where a.classid = b.id and ( a.classid = 1 ) and ( a.upid = 0 ) order by a.orderId desc, a.addtime desc,a.id desc
例如下面的例子
select a.*,b.classname as upClassname,
(select count(*) from fgnews c where upid= a.id) as downNum
from fgnews a ,fgnewsClass b where a.classid = b.id and ( a.classid = 1 ) and ( a.upid = 0 ) order by a.orderId desc, a.addtime desc,a.id desc
评论Feed: http://blog.xg98.com/feed.asp?q=comment&id=1051
这篇日志没有评论。
此日志不可发表评论。