急问``~~~~~~大家都进来看看

youngcy 2004-07-24 11:36:26
我要实现一条select * from newhelp left join student on newhelp.studentid=student.studentid
然后吧上面的sql作为一个表,然后再其中查询 即
select top 1 * from (select * from newhelp left join student on newhelp.studentid=student.studentid) as table1
现在table1中有两个studentid,所以sql语句不能执行,怎样去掉其中的一个studentid字段,或者改名怎样的?
...全文
56 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
woodywjl 2004-07-25
  • 打赏
  • 举报
回复
把你的top 1 * 的 * 替换为你想要的那些字段比如
select top 1 student.studentid from (select * from newhelp left join student on newhelp.studentid=student.studentid) as table1
anggogo 2004-07-25
  • 打赏
  • 举报
回复
你是说你的 fieldname 还动态改动?

为什么不在 第二个 select 里 specify 每一个 field name,只选择你要的 fieldname,那就绝对不会有问题啦
PPLUNCLE 2004-07-25
  • 打赏
  • 举报
回复
呵呵,可以用存储过程吗
还请高人看看吧,不过周末高人也都休息了
youngcy 2004-07-25
  • 打赏
  • 举报
回复
这个我事知道,不过我得字段有一部分事动态改变的

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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