***************高难改的distinct

kelly_1127 2005-09-21 03:49:07
sql="select distinct(name),address,company from name where company<>'' and address<>'' "

这句话中,我想得出distinct(name),但又不能得到address,company ,怎么改啊
...全文
77 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhengxionghua1983 2005-09-21
  • 打赏
  • 举报
回复
不知道是你表达的不清楚。还是我的理解能力差。真不明白你在说什么。你是想得到不重复元组信息还是想得到你给出的字段的这此信息都要显示。还是别的。
GageCSDN 2005-09-21
  • 打赏
  • 举报
回复
select distinct [name],address=(select top 1 address from [name] where [name]=a.[name]),company=(select top 1 company from [name] where name=a.[name]) from [name] a where company<>'' and address<>''

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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