1

嗨,我正在使用 select 语句将值插入表中。但是插入没有发生。select语句的结果集中有5行。但是,当我使用选择数据触发插入语句时,不会将其插入表中。

我检查了属性的顺序,一切似乎都是正确的。我还尝试使用“values”关键字在表中插入一行,并在此帮助下插入数据。为什么我的插入不能使用“选择”命令?

请帮助其紧急。

下面是查询

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 中。

不在不工作的条款中。有什么建议么????

4

1 回答 1

0

这里少了一个逗号:

   b.totalgrades as FinalGrdaes
    ' ' as Misc

固定版本:

   b.totalgrades as FinalGrdaes,
    ' ' as Misc
于 2013-03-22T19:09:09.137 回答