急!急!急! 有关GROUP BY 和 ORDER BY 问题

jonathanwang715 2003-10-17 12:58:15
我现在编一个简单报表,格式
select table1.column1,table2.column2, ...
from table1 inner join table2,table2 inner join table3, ...
order by table1.column1,table2.column2
但是查询出来的结果有多行重复,我用DISTINCT语句系统提示
"The text ntext or image data type cannot be select as DISTINCT"
说明不能用文本或IMAGE DATA 进行排序,我又用GROUP BY并把DISTINCT 和ORDER BY去掉,系统提示
"Column table1.column1' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
请教各位"高人"我着菜鸟如何去处这些重复的记录:),谢谢
...全文
27 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jonathanwang715 2003-10-17
  • 打赏
  • 举报
回复
首先谢谢楼上的LEAYH,但我的关联是在系统中通过响应栏位对应上的,那我不是自己编写出来的,是系统产生的SQL语句,那我要对文本内容进行排序应该用什么语句,把重复的记录去掉,谢谢
leayh 2003-10-17
  • 打赏
  • 举报
回复
你的语句写法有问题,应该这样写:
select table1.column1,table2.column2,... from table1 inner join table2( inner join table3 (inner join table4))) order by table1.column1,table2.column2
就行了。

22,206

社区成员

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

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