SELECT INTO不起作用

时间:2009-07-27 18:29:19

标签: mysql sql mysql-error-1064

我想测试一下情况,但我需要添加一行虚拟数据来测试这个假设。所以,根据this mySQL manual page for SELECT INTO,我的查询是正确的:

SELECT INTO courses.sections_rfip
  (SectionID, CourseID, SectionNumber, Term, Credits, CutOffDate, StartDate, EndDate, LastDateToWithDraw, ContinuousIntake, AcceptsRegistration, Fee, Instructor, SectionDescription, RegistrationRestrictions, MeetingTime, Notes, Active, Created, SetInactive)
  SELECT 3, 
         s.CourseID, 
         s.SectionNumber, 
         s.Term, 
         s.Credits, 
         s.CutOffDate, 
         s.StartDate, 
         s.EndDate, 
         s.LastDateToWithDraw, 
         s.ContinuousIntake, 
         s.AcceptsRegistration, 
         s.Fee, 
         s.Instructor, 
         s.SectionDescription, 
         s.RegistrationRestrictions, 
         s.MeetingTime, 
         s.Notes, 
         s.Active, 
         s.Created, 
         s.SetInactive 
    FROM courses.sections_rfip s
   WHERE s.sectionid = 1

但是我收到以下错误信息:

“您的SQL语法有错误;请查看与您的MySQL服务器版本对应的手册,以便在'INTO courses.sections_rfip附近使用正确的语法 (SectionID,CourseID,SectionNumber,Term,Credits,'at line 1“

所以在INTO中有些东西腐烂了,这对我来说并不明显 - 为什么?帮助?

1 个答案:

答案 0 :(得分:5)

尝试INSERT INTO:http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-select-into-table.html

编辑:哎呀。没意识到那是你列出的那个页面。但是,正如它所说,使用INSERT INTO,因为SELECT INTO(来自Sybase)将无法工作。