怎么写
sql="select APPLY_DEPARTMENT,MAJOR_IDEA,IT_UNDERTAKER,TOTESTTIME,RequireDate,AnalysDate,CodeDate,TestDate,FINISH_TIME,max(EstiTime) as (EstiTime) from songzw.REQUIRE_BILL inner join REQUIRE_ESTI on songzw.REQUIRE_BILL.IT_NO=REQUIRE_ESTI.IT_NO where 1=1"
我这样写可是不对啊作者: 罗ぷ曼ㄉ帝Ke 时间: 2010-1-8 01:31
搞定啦,贴出来让大家看看 songzw是用户名,不要也可以啦
sql="SELECT songzw.Require_Bill.Apply_Department, songzw.Require_Bill.Major_Idea, songzw.Require_Bill.IT_Undertaker,songzw.Require_Bill.RequireCheckDate,songzw.Require_Bill.DealCheckDate, songzw.Require_Bill.TOTESTTIME, songzw.Require_Bill.RequireDate, songzw.Require_Bill.AnalysDate, songzw.Require_Bill.CodeDate, songzw.Require_Bill.TestDate,songzw.Require_Bill.Finish_Time, ss.ESTItime FROM songzw.Require_Bill INNER JOIN (SELECT IT_NO, MAX(ESTItime) AS ESTItime FROM REQUIRE_ESTI GROUP BY IT_NO) ss ON songzw.Require_Bill.FLOWSN = ss.IT_NO where 1=1"作者: 红苹果校园 时间: 2010-1-8 01:31
1=1"这个是什么????
他是想合并这两个表 WHERE IT_NO=IT_NO作者: 太阳神 时间: 2010-1-8 01:31
两个表的关联语句应该放在WHERE后面...怎么你放在前面?你那个是ACCESS生成的吧...作者: 绿茶 时间: 2010-1-8 01:31
sql="select APPLY_DEPARTMENT,MAJOR_IDEA,IT_UNDERTAKER,TOTESTTIME,RequireDate,AnalysDate,CodeDate,TestDate,FINISH_TIME,max(EstiTime) as (EstiTime) from songzw.REQUIRE_BILL inner join REQUIRE_ESTI on songzw.REQUIRE_BILL.IT_NO=REQUIRE_ESTI.IT_NO where 1=1"这个是什么????
sql="select APPLY_DEPARTMENT,MAJOR_IDEA,IT_UNDERTAKER,TOTESTTIME,RequireDate,AnalysDate,CodeDate,TestDate,FINISH_TIME,max(EstiTime) as (EstiTime)
From REQUIRE_BILL RB,REQUIRE_ESTI RB
Where RB.IT_NO=RE.IT_NO
这样试一下...不过因为你没用创建主/外键...有可能出现笛卡儿积现象....作者: 专属天使 时间: 2010-1-8 01:31
我是用SQL作者: £籍の口∮ 时间: 2010-1-8 01:31
有没有什么报错信息?还是你搜索出来的结果不对?
where 1=1只是为了搜索出所有数据,因为1=1,换成2=2也一样的.
sql="select APPLY_DEPARTMENT,MAJOR_IDEA,IT_UNDERTAKER,TOTESTTIME,RequireDate,AnalysDate,CodeDate,TestDate,FINISH_TIME,max(EstiTime) as (EstiTime) from songzw.REQUIRE_BILL inner join REQUIRE_ESTI on songzw.REQUIRE_BILL.IT_NO=REQUIRE_ESTI.IT_NO where 1=1"
songzw是什么?
sql ="select APPLY_dEPARTMENT,MAJOR_IDEA,IT_UNDERTAKER,TOTESTTIME,RequireDate,AnalysDate,CodeDate,TestDate,FINISH_TIME from REQUIRE_BILL WHERE IT_NO IN (select IT_NO from REQUIRE_ESTI order by EstiTime desc)"
试试这样行不行?