SELECT INTO not working

好久不见. 提交于 2019-11-30 06:01:35

问题


I'd like to test a situation, but I need to add a dummy row of data to test the hypothesis. So, according to this mySQL manual page for SELECT INTO, my query is correct:

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

But I get the following error msg:

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO courses.sections_rfip (SectionID, CourseID, SectionNumber, Term, Credits, ' at line 1"

So there's something rotten at the INTO, which isn't obvious to me why - help?


回答1:


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

EDIT: Oops. Didn't realize that was the same page you had listed. However, as it says, use INSERT INTO since SELECT INTO (from Sybase) won't work.



来源:https://stackoverflow.com/questions/1189810/select-into-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!