access怎么查询这个 - MS-SQL Server / 基础类
and id not in (select distinct client from tb_talk where DATEDIFF('d', #"&date&"#, adddate)<=45)
这个是从tb_client中找出超过45天没有在tb_talk 有记录的数据
结果貌似是对的
但效率太低了
我想这样应该快一点
and (select 1 from em_talk where client = tb_client.id DATEDIFF('d', #"&date&"#, adddate)<=45) 不存在
但不知应该怎么写
ACCESS中不知道有没EXISTS
SQL code:
select * from tb t where ... and not exists (select * from tb_talk where DATEDIFF('d', #"&date&"#, adddate)<=45 and t.id=client)
SQL code:
and id not in (select client from tb_talk where DATEDIFF('d', #"&date&"#, adddate)<=45)--去掉distinct
and not exists (select 1 from tb_talk where client = em_client.id and DATEDIFF('d', #"&date&"#, adddate)<=45)
这样可以了
相关问答:
现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......
rt,我试了网上直连Acces数据库的方法,windows下没有问题,但是在linux下不行,谁能给点提示?谢谢
你怎么连的?
Acces数据库..
你怎么练的呢?
Java code:
static String DBDRIVER = "sun.jd ......
tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......
查询学生平均成绩及其名次
SELECT 1+(SELECT COUNT( distinct 平均成绩)
from (SELECT S#,AVG(score) AS 平均成绩
from SC&n ......