2个SQL语句的区别
来源:互联网 发布:手机点击类软件 编辑:程序博客网 时间:2024/05/16 17:49
方法一:
DECLARE @r varchar(8000)
SET @r = ''
select @r=@r+'/'+ (select entCode from FDAEnterprise where EntID=entperJob.entid) from EntPerJob where PerID=21885
print @r
与
方法二:
DECLARE @r varchar(8000)
SET @r = ''
select @r=@r+'/'+ temp.entCode from (select entCode from FDAEnterprise where EntID in (select EntID from EntPerJob where PerID=21885)) temp
print @r
区别?
结果一:
/0201000032/0201000032/0201000032/0201000032/0102000016 有重复
结果二:
/0102000016/0201000032 无重复
方法1:
select temp.pharmacisttypeid,count(*) as num from ( select pharmacisttypeid from JobNameAndPharmacistTypeRelation b
inner join
(select jobid from entperjob where entid=5 ) a
on b.jobid=a.jobid where b.fdaid=101) temp
group by temp.pharmacisttypeid
消除重复
方法2:
select temp.pharmacisttypeid,count(*) as num from ( select * from JobNameAndPharmacistTypeRelation
where jobid in (select jobid from entperjob where entid=5) and fdaid=101) temp group by temp.pharmacisttypeid
有重复
- 2个SQL语句的区别
- 2个SQL语句的区别(续)
- 经典SQL语句大全、50个常用的sql语句
- 经典SQL语句大全、50个常用的sql语句
- 经典SQL语句大全、50个常用的sql语句
- 经典SQL语句大全、50个常用的sql语句
- 求 二个简单的 SQL语句
- 50个常用的sql语句
- 50个常用的sql语句
- 50个常用的SQL语句
- 50个经典的SQL语句
- 50个经典的sql语句
- 50个常用的sql语句
- 50个常用的sql语句
- 50个常用的sql语句
- 50个经典常用的sql语句
- 50个常用的sql语句
- 50个常用的sql语句
- 点击小图动态弹出大图
- 在内存中运行可执行程序
- 嵌入式移动通信技术研究与发展
- 用VS2005也能制作体积很小的Win32程序(2KB - 3KB)
- 计算两个日期间相隔了多少周
- 2个SQL语句的区别
- 截取系统 API 调用
- 输入一个不多于五位的正整数,判断它是几位数,分别打印出各位数字,并按逆序打印各位数字
- SQL 联接--->完整外联接 (完整外部联接 ..full outer join..on)
- Windows Sockets API实现网络异步通讯
- 多线程:声明为“静态”的成员函数如何访问类成员变量
- Swing实现Windows任务窗
- 透过色彩搜索 Flickr 图片
- 博客怎么写?