易截截图软件、单文件、免安装、纯绿色、仅160KB

sql 语句 - .NET技术 / ASP.NET

两张表

tb1

id riqi
aa 2010.01.01
aa 2010.02.02
bb 2010.01.01
bb 2010.02.02
cc 2010.01.01

tb2

id riqi
aa 2010.01.01 
bb 2010.01.01
bb 2010.02.02

想要得到的结果为 
id riqi  
aa 2010.02.02
cc 2010.01.01


没有唯一键

select * from tb1 where (id+cast(riqi as varchar)) not exists (select (rd+ cast(riqi as varchar)) ss from tb2)

select * from tb1 where (id+cast(riqi as varchar)) not in (select (rd+ cast(riqi as varchar)) ss from tb2)

select * from tb1 where (id+cast(riqi as varchar)) not exists (select (rd+ cast(riqi as varchar)) ss from tb2)===>
select * from tb1 where (id+cast(riqi as varchar)) not in (select (rd+ cast(riqi as varchar)) ss from tb2)

2楼正解,not exists 换成 not in 也一样

这位老哥回帖好快。。。。。。

SQL code:

select * from tb1 t1 where not exists(select 1 from tb2 where id=t1.id and riqi=t1.riqi)



引用
这位老哥回帖好快。。。。。。

这年头 手慢了不行

想要的是 select max(riqi),id from tb1 group by id 这个不在tb2中的

网速快,机器好,能力强。
斗不过你们啊。。。。55555


都好快
{{----}


相关问答:

jsp链接sql2000的疑问?



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

sql小小的疑问 - .NET技术 / C#

可能因为工作的原因 接触数据库这块比较少,之前都是做程序这块,数据库这块都有专门的人来做 分工都很明细 所以对数据库这一块完全不了解。前段时间 去面试了几家公司 几乎都是在数据库这块挂掉的 连个简单的SQ ......

求助asp.net图片上传 - .NET技术 / ASP.NET

就是一个按钮,点击之后打开对话框,然后选取图片。就这样上传。。
怎么实现。在网上搜到那么多的代码,全是很多的那种,不知道,看不下去。
所以在这里想请大哥大姐帮帮忙。

使用自带的fileupload控件可以实现 ......

请教SQLSERVER的两个问题 - MS-SQL Server / 疑难问题

1。怎样使xp_cmdshell能完整输出超过255个字符的字符串。
2。select 时,检索速度是与from后的 TABLE顺序有关,还是与where条件的顺序有关(TABLE数据多少 )
在系统属性设定里有个选项,可以修改单字段输出字数限制. ......

sql 问题 - MS-SQL Server / 基础类

需求如下:
学院 academy(aid,aname)
班级 class(cid,cname,aid)
学生 stu(sid,sname,aid,cid)
住宿区 region(rid,rname)
宿舍楼 build(bid,rid,bnote) bnote是‘男’/‘女’
宿舍 dorm(did,rid,bid,bedn ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号