[sqlite] Using CTE with INSERT

2015-10-13 Thread Clemens Ladisch
Don V Nielsen wrote: > I'm struggling to implement an INSERT statement that get's is values from a > CTE. > > insert into vo_crrt_pieces (recid) > values ( > with > pkg_controls AS ( > SELECT * FROM d_pkg WHERE pkg_level = 'CRD' > ) > -- select pieces that meeting pkg and pkg_level mini

[sqlite] Using CTE with INSERT

2015-10-13 Thread John McKown
On Tue, Oct 13, 2015 at 8:28 AM, Don V Nielsen wrote: > The syntax "WITH p AS (SELECT 1) INSERT INTO t(x) SELECT * FROM p;" throws > the same exception: "[2015-10-13 08:20:22] [1] [SQLITE_ERROR] SQL error or > missing database (near ")": syntax error)" > > On my system, RedHat Linux, Fedora 22, x

[sqlite] Using CTE with INSERT

2015-10-13 Thread Don V Nielsen
This is an IDE issue. If I run my queries from the command line, all is good. Sorry for the confusion. It is when I run my queries through my Rubymine IDE that I am getting exceptions thrown. I need to investigate what version of Sqlite is being implemented. Something learned is always a good

[sqlite] Using CTE with INSERT

2015-10-13 Thread Don V Nielsen
The syntax "WITH p AS (SELECT 1) INSERT INTO t(x) SELECT * FROM p;" throws the same exception: "[2015-10-13 08:20:22] [1] [SQLITE_ERROR] SQL error or missing database (near ")": syntax error)" On Tue, Oct 13, 2015 at 8:17 AM, Clemens Ladisch wrote: > Don V Nielsen wrote: > > I'm struggling to

[sqlite] Using CTE with INSERT

2015-10-13 Thread Don V Nielsen
I'm struggling to implement an INSERT statement that get's is values from a CTE. What I want to do is identify zip/crrt combinations at meet minimum qty specifications, and then insert into a table the recid values of those record destined to the identify zip/crrts. While the syntax below is inco