您好我正在使用select语句将值插入到表中。但插入不会发生。 select语句的结果集中有5行。但是当我激发插入语句与选择数据没有被插入到表中。使用select语句在表中插入
我检查了属性的顺序,一切似乎都是正确的。我还尝试使用“values”关键字在表格中插入单行,并在此帮助下插入数据。 为什么我的插入不能使用“select”命令?
请帮忙。
下面是查询
insert into schema1.tabletemp
select distinct
a.name as name,
a.stu_number as rollno,
c.userid as login_id,
b.Address as stuAddress,
b.totalgrades as FinalGrdaes
' ' as Misc
from
Schema1.stu_info a, schema1.address_info b, schema1.logindetails c
where
a.stu_no = b.record_no and
a.status in ('Active') and
c.last_name=a.stu_lname and
c.first_name=a.stu_fname and
a.stu_no not in (select distinct student_number from schema1.student_final_records);
这个查询试图学生数据插入到tabletemp。标准是student_final_record表中存在的学生记录不应再次插入。因此,系统中新增的任何学号,即不存在于student_final_record中的学号都将插入到tabletemp中。
不在工作中不工作。有什么建议么????
请shjare您的DDL,样本数据,并插入查询 – ljh 2013-03-21 21:27:38
向我们展示你的SQL,也许我们可以帮助。 – 2013-03-21 21:29:09
您是否在INSERT ... SELECT之后执行了COMMIT语句? – 2013-03-22 02:35:29