Re: [sqlite] is this possible

2019-03-29 Thread Simon Slavin
On 29 Mar 2019, at 1:55pm, Dan Kennedy wrote: > The error doesn't occur unless you actually query the view though, correct? My theory on SQLite was that the VIEW definition was only syntax-checked and not compiled in any way. So you could do CREATE VIEW v as select * from t ORDER BY a; CREATE

Re: [sqlite] is this possible

2019-03-29 Thread Igor Tandetnik
On 3/29/2019 9:55 AM, Dan Kennedy wrote: On 29/3/62 03:00, Igor Tandetnik wrote: On 3/28/2019 3:21 PM, Mark Wagner wrote: Imagine I have these two tables and one view defining a join. CREATE TABLE t (foo); CREATE TABLE s (bar); CREATE VIEW v as select * from t join s on (foo = q); Surprisin

Re: [sqlite] is this possible

2019-03-29 Thread Dan Kennedy
On 29/3/62 03:00, Igor Tandetnik wrote: On 3/28/2019 3:21 PM, Mark Wagner wrote: Imagine I have these two tables and one view defining a join. CREATE TABLE t (foo); CREATE TABLE s (bar); CREATE VIEW v as select * from t join s on (foo = q); Surprisingly, this last statement succeeds. But if

Re: [sqlite] is this possible

2019-03-28 Thread Keith Medcalf
On Thursday, 28 March, 2019 13:21, Mark Wagner wrote: >Imagine I have these two tables and one view defining a join. >CREATE TABLE t (foo); >CREATE TABLE s (bar); >CREATE VIEW v as select * from t join s on (foo = q); >I appear to be able to do this query: >select 20 as q, * from t join s on (

Re: [sqlite] is this possible

2019-03-28 Thread Igor Tandetnik
On 3/28/2019 3:21 PM, Mark Wagner wrote: Imagine I have these two tables and one view defining a join. CREATE TABLE t (foo); CREATE TABLE s (bar); CREATE VIEW v as select * from t join s on (foo = q); Surprisingly, this last statement succeeds. But if you then close the database and try to op

Re: [sqlite] is this possible

2019-03-28 Thread Amit Yaron
From the page https://sqlite.org/lang_createview.html : "The CREATE VIEW command assigns a name to a pre-packaged SELECT statement ..." So, it seems that the command "CREATE VIEW" just creates a name for a SELECT statement, and checks nothing more than syntax. On 28.3.2019 21:21, Mark Wagne

[sqlite] is this possible

2019-03-28 Thread Mark Wagner
Imagine I have these two tables and one view defining a join. CREATE TABLE t (foo); CREATE TABLE s (bar); CREATE VIEW v as select * from t join s on (foo = q); I appear to be able to do this query: select 20 as q, * from t join s on (foo=q); But apparently I cannot do this: sqlite> select 20 a

Re: [sqlite] Is this possible?

2009-03-01 Thread P Kishor
On Sun, Mar 1, 2009 at 4:43 PM, Mike Yenco wrote: > > On Mar 1, 2009, at 5:18 PM, P Kishor wrote: > >> It is going to get even more complicated and soon approach Igor-level >> of complexity. So, for sanity's sake, it would probably be done better >> in your application. > > Thanks for the explanat

Re: [sqlite] Is this possible?

2009-03-01 Thread Mike Yenco
On Mar 1, 2009, at 5:18 PM, P Kishor wrote: > It is going to get even more complicated and soon approach Igor-level > of complexity. So, for sanity's sake, it would probably be done better > in your application. Thanks for the explanation. Yeah, as I said in one of my previous emails, my first

Re: [sqlite] Is this possible?

2009-03-01 Thread P Kishor
On Sun, Mar 1, 2009 at 4:04 PM, Mike Yenco wrote: > > On Mar 1, 2009, at 2:15 PM, Martin Engelschalk wrote: > >> Hi Mike, >> >> Yes, this is possible, however, it is complicated. > > Hi Martin, > > Thanks for the reply.  It usually is complicated :-) > > >> select Name, case OrderValue when 0 then

Re: [sqlite] Is this possible?

2009-03-01 Thread Mike Yenco
On Mar 1, 2009, at 2:15 PM, Martin Engelschalk wrote: > Hi Mike, > > Yes, this is possible, however, it is complicated. Hi Martin, Thanks for the reply. It usually is complicated :-) > select Name, case OrderValue when 0 then NULL else ContainerId end as > ContainerId > from > ( > select dis

Re: [sqlite] Is this possible?

2009-03-01 Thread Martin Engelschalk
Hi Mike, Yes, this is possible, however, it is complicated. Lets first create the tables an populate them: create table Container (ContainerName text, ContainerId text primary key) create table Contents (ContentName text, ContainerId text) insert into Container values ('Fruit', 'ABC-0001'); ins

Re: [sqlite] Is this possible?

2009-03-01 Thread Mike Yenco
OK, let's see if I can clarify this. I'm using "blank", "Group", and "Code" as placeholders here. Blank is a column that contains nothing (An empty placeholder I need for display purposes). Group could be any text. Code is some ID text. Table B is being written to by some third-party code

Re: [sqlite] Is this possible?

2009-03-01 Thread P Kishor
On Sun, Mar 1, 2009 at 11:14 AM, Mike Yenco wrote: > Ok, I guess this list doesn't support image attachments.  Let's see if > I can sort of illustrate what I'm looking to do in text without > requiring 1000 words. > > Table A > blank | Group 1 | Code 1 > blank | Group 2 | Code 2 > blank | Group 3

Re: [sqlite] Is this possible?

2009-03-01 Thread Martin Engelschalk
Hi Mike, sorry, i don't fully get it. However, a single SQL statement can not return data rows of different structure as you indicated in your example. Especially, I am confused about "blank". It seems to come from Table A, same as "Group *". Do you want to put "Group *" as a sort of headline,

Re: [sqlite] Is this possible?

2009-03-01 Thread Mike Yenco
Ok, I guess this list doesn't support image attachments. Let's see if I can sort of illustrate what I'm looking to do in text without requiring 1000 words. Table A blank | Group 1 | Code 1 blank | Group 2 | Code 2 blank | Group 3 | Code 3 Table B Item 1 | Code 1 Item 2 | Code 1 Item 3 | Code

Re: [sqlite] Is this possible?

2009-03-01 Thread Martin Engelschalk
Hi Mike, you can't use attachments in this mailing list. Best post your data model, some data and the desired result. Martin Mike Yenco wrote: > Is there a way that SQLite can return all matching items to a search > string in Table B, but return a group name from Table A before each > set of m

[sqlite] Is this possible?

2009-03-01 Thread Mike Yenco
Is there a way that SQLite can return all matching items to a search string in Table B, but return a group name from Table A before each set of matching items within the result? (see attached image). ___ sqlite-users mailing list sqlite-users@sqli

Re: [sqlite] Is this possible in SQLite?

2005-03-17 Thread Dennis Cote
John O'Neill wrote: Hi Dennis, Thanks for the reply. In the original "INSERT" commands, my intention was to update a field in the columns as they were being copied to the new table. Sorry, I didn't mean just "SELECT ... WHERE id=1" as the only condition...I'd like to select those items and upda

RE: [sqlite] Is this possible in SQLite?

2005-03-17 Thread Bob Dankert
O'Neill [mailto:[EMAIL PROTECTED] Sent: Thursday, March 17, 2005 3:48 PM To: sqlite-users@sqlite.org Subject: RE: [sqlite] Is this possible in SQLite? Hi Dennis, Thanks for the reply. In the original "INSERT" commands, my intention was to update a field in the columns as they were bein

RE: [sqlite] Is this possible in SQLite?

2005-03-17 Thread John O'Neill
her unique value. I guess this question is can I combine an UPDATE...SET with an INSERT...SELECT command? Thanks, John -Original Message- From: Dennis Cote [mailto:[EMAIL PROTECTED] Sent: Thursday, March 17, 2005 4:32 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Is this possible

Re: [sqlite] Is this possible in SQLite?

2005-03-17 Thread Dennis Cote
John O'Neill wrote: Hello all, I have a fairly simple DB with two tables. I'm trying to combine a SELECT and UPDATE command, if it is possible: CREATE TABLE a (id PRIMARY KEY, data INT); CREATE TABLE b (id INT, data INT); INSERT INTO a VALUES( 1, 100 ); INSERT INTO b VALUES( 1, 101 ); INSERT INTO

Re: [sqlite] Is this possible in SQLite?

2005-03-17 Thread Kurt Welgehausen
> Is there a way to do the following: > > INSERT INTO acopy SELECT * FROM a WHERE id = 1 ( SET id = some value X ); > INSERT INTO bcopy SELECT * FROM b WHERE id = 1 ( SET id = X ); http://www.sqlite.org/lang_insert.html sql-statement ::= INSERT [OR conflict-algorithm] INTO [dat

[sqlite] Is this possible in SQLite?

2005-03-17 Thread John O'Neill
Hello all, I have a fairly simple DB with two tables. I'm trying to combine a SELECT and UPDATE command, if it is possible: CREATE TABLE a (id PRIMARY KEY, data INT); CREATE TABLE b (id INT, data INT); INSERT INTO a VALUES( 1, 100 ); INSERT INTO b VALUES( 1, 101 ); INSERT INTO b VALUES( 1, 102