sql语句的小问题,精简一下sql语句

reallijin 2011-06-06 11:19:28
select id ,sortname,leijibie,(select count(1) from li_item b where isnull(lei1,name)=isnull(a.id,a.sortname) ) from li_sort a where parentid = '0' ORDER BY (select count(1) from li_item where isnull(lei1,name)=isnull(a.id,a.sortname) ) DESC
-------------------------------------
出现了两次 (select count(1) from li_item b where isnull(lei1,name)=isnull(a.id,a.sortname) )

请问用什么参数或数值代替另一个地方?
...全文
23 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
reallijin 2011-06-06
  • 打赏
  • 举报
回复
高手呀,你太厉害了!时间不到呢,到了时间给你分。哈哈
cd731107 2011-06-06
  • 打赏
  • 举报
回复
select id ,sortname,leijibie,
排序名称=(select count(1) from li_item b where isnull(lei1,name)=isnull(a.id,a.sortname) )
from li_sort a where parentid = '0' ORDER BY 排序名称 DESC

22,207

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧