Sean Miller
Sean Miller

Reputation: 13

Query to new table SQLite

the following query returns results successfully using the only two tables in by database. I'm having problems directing the results to create a new table.

    select Object.Xref, Object.area, Object.screen, Object.field, locator.data insert into Results from Object inner join locator on Object.area = locator.area and Object.screen = locator.screen and Object.field = locator.field      

I get the following error: "near "insert": syntax error:"

If I take the insert out. it works fine.

Upvotes: 0

Views: 34

Answers (1)

peterm
peterm

Reputation: 92785

INSERT goes first. Try

INSERT INTO Results
SELECT o.Xref, o.area, o.screen, o.field, l.data 
  FROM Object o JOIN locator l 
   ON o.area = l.area 
  AND o.screen = l.screen 
  AND o.field = l.field

Here is a SQLFiddle demo

Upvotes: 0

Related Questions