如题,写了如下一段sql语句insert T_jitong6(jixing,chehao,ReportTime,Peishu,ComeinTime,[State],Hidden)
select 车型,车号, 日期, 所属车间,入库时间,'合格','无'
from 机统6
where not exits
(select 1 from T_jitong6 where ReportTime =机统6.日期
and jixing = 机统6.车型 and chehao=机统6.车号
and ComeinTime=机统6.入库时间
and Peishu=机统6.所属车间)在查询分析器中得出如下错误:
服务器: 消息 156,级别 15,状态 1,行 6
在关键字 'select' 附近有语法错误。
服务器: 消息 170,级别 15,状态 1,行 9
第 9 行: ')' 附近有语法错误。
不知道是什么错误,大家帮忙看一下。
select 车型,车号, 日期, 所属车间,入库时间,'合格','无'
from 机统6
where not exits
(select 1 from T_jitong6 where ReportTime =机统6.日期
and jixing = 机统6.车型 and chehao=机统6.车号
and ComeinTime=机统6.入库时间
and Peishu=机统6.所属车间)在查询分析器中得出如下错误:
服务器: 消息 156,级别 15,状态 1,行 6
在关键字 'select' 附近有语法错误。
服务器: 消息 170,级别 15,状态 1,行 9
第 9 行: ')' 附近有语法错误。
不知道是什么错误,大家帮忙看一下。
select 车型,车号, 日期, 所属车间,入库时间,'合格','无'
from 机统6
where not exists -----exists
(select 1 from T_jitong6 where ReportTime =机统6.日期
and jixing = 机统6.车型 and chehao=机统6.车号
and ComeinTime=机统6.入库时间
and Peishu=机统6.所属车间)
select 车型,车号, 日期, 所属车间,入库时间,'合格','无'
from 机统6
where not EXISTS
(select 1 from T_jitong6 where ReportTime =机统6.日期
and jixing = 机统6.车型 and chehao=机统6.车号
and ComeinTime=机统6.入库时间
and Peishu=机统6.所属车间)