[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Bart Smissaert
Well, select column A from table B, kind of implies that that column A can only come from table B. This is what most people would think I would guess. RBS On Sun, Mar 22, 2015 at 10:27 PM, Igor Tandetnik wrote: > On 3/22/2015 11:50 AM, Bart Smissaert wrote: > >> Still, in this particular case i

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Stephen Chrzanowski
I think the confusion comes down to where the subslect only refers to exactly one table. That single query has nothing to do with any other table. There isn't a join, there isn't a reference to any other table, so the fuzzy question is why would an ambiguous error come up if there is exactly only

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Igor Tandetnik
On 3/22/2015 6:52 PM, Scott Robison wrote: > Thinking back to when I was first learning SQL, I remember being surprised > in a similar way. To my procedural / object oriented / imperative way of > thinking, the subselect was like a function Even with this way of looking it at it - wouldn't it be s

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Igor Tandetnik
On 3/22/2015 11:50 AM, Bart Smissaert wrote: > Still, in this particular case it seems odd as there is only one column and > one table in the sub-select. I'm not sure I understand what significance you ascribe to this fact. Why again should the number of columns or tables in subselect matter? --

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Scott Robison
On Sun, Mar 22, 2015 at 5:02 PM, Igor Tandetnik wrote: > On 3/22/2015 6:52 PM, Scott Robison wrote: > >> Thinking back to when I was first learning SQL, I remember being surprised >> in a similar way. To my procedural / object oriented / imperative way of >> thinking, the subselect was like a fun

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread R.Smith
On 2015-03-22 04:15 PM, Bart Smissaert wrote: > Sorry, that table did indeed not have a column named emis_number, my > mistake. > Still, the error message ambiguous column name doesn't seem quite right. > Should that not also be no such column: emis_number? But this is not true, there /IS/ a col

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Scott Robison
On Sun, Mar 22, 2015 at 4:27 PM, Igor Tandetnik wrote: > On 3/22/2015 11:50 AM, Bart Smissaert wrote: > >> Still, in this particular case it seems odd as there is only one column >> and >> one table in the sub-select. >> > > I'm not sure I understand what significance you ascribe to this fact. Wh

[sqlite] Query times vary between 0.2 s and 30 s for very

2015-03-22 Thread James K. Lowden
On Sat, 21 Mar 2015 14:36:47 -0600 Scott Robison wrote: > On Mar 21, 2015 1:43 PM, "James K. Lowden" > wrote: > > > > The query optimizer has to be sophisticated enough to recognize > > those conditions, which is unlikely in the case of a temporary > > table. > > Are temporary tables really tha

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Bart Smissaert
OK, will remember that. Still, in this particular case it seems odd as there is only one column and one table in the sub-select. Learned something there. RBS On Sun, Mar 22, 2015 at 3:03 PM, Igor Tandetnik wrote: > On 3/22/2015 10:48 AM, Bart Smissaert wrote: > >> But I thought that as the non

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Ketil Froyn
But both the patients table and the DIABETIC_ISSUES_LAST table have columns called emis_number. Since your query turns out to be valid despite not doing what you expected, sqlite doesn't know which of those columns you're referring to. So it looks like the "ambiguous column name" is in fact the cor

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Bart Smissaert
My misunderstanding and see my reply to Ketil. RBS On Sun, Mar 22, 2015 at 2:47 PM, Igor Tandetnik wrote: > On 3/22/2015 10:15 AM, Bart Smissaert wrote: > >> Sorry, that table did indeed not have a column named emis_number, my >> mistake. >> Still, the error message ambiguous column name doesn'

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Bart Smissaert
But I thought that as the non-aliased column emis_number is in the sub-select (select emis_number from DIABETICS) that column name could only apply to the table DIABETICS and there should be no ambiguity. RBS On Sun, Mar 22, 2015 at 2:33 PM, Ketil Froyn wrote: > But both the patients table and

[sqlite] Query times vary between 0.2 s and 30 s for very

2015-03-22 Thread Scott Robison
On Sun, Mar 22, 2015 at 2:47 PM, James K. Lowden wrote: > On Sat, 21 Mar 2015 14:36:47 -0600 > Scott Robison wrote: > > > > > > > The query optimizer has to be sophisticated enough to recognize > > > those conditions, which is unlikely in the case of a temporary > > > table. > > > > Are temporar

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Bart Smissaert
Sorry, that table did indeed not have a column named emis_number, my mistake. Still, the error message ambiguous column name doesn't seem quite right. Should that not also be no such column: emis_number? RBS On Sun, Mar 22, 2015 at 2:06 PM, Igor Tandetnik wrote: > On 3/22/2015 8:50 AM, Bart Smi

[sqlite] Having issue working with SQLite & Windows Phone 8.1!

2015-03-22 Thread Stephen Chrzanowski
Do you have a working database object that has its hands on the physical database? At application initilization when opening the database, perform a simple query against this table, or another, and verify that you are indeed pulling from the CORRECT database. Do a search on the local file system

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Bart Smissaert
This SQL gives me the error ambiguous column name: emis_number: select g.gp_name, d.emis_number from DIABETIC_ISSUES_LAST d inner join patients p on(d.emis_number = p.emis_number) inner join gp_table g on(p.usual_gp_index_number = g.gp_id) where d.emis_number not in(select emis_number from DIABETI

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Igor Tandetnik
On 3/22/2015 10:48 AM, Bart Smissaert wrote: > But I thought that as the non-aliased column emis_number is in the > sub-select (select emis_number from DIABETICS) > that column name could only apply to the table DIABETICS and there should > be no ambiguity. A subselect can happily use columns from

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Igor Tandetnik
On 3/22/2015 10:15 AM, Bart Smissaert wrote: > Sorry, that table did indeed not have a column named emis_number, my > mistake. > Still, the error message ambiguous column name doesn't seem quite right. > Should that not also be no such column: emis_number? What do you mean, no such column? There a

[sqlite] What is wrong with this simple SQL?

2015-03-22 Thread Igor Tandetnik
On 3/22/2015 8:50 AM, Bart Smissaert wrote: > select g.gp_name, d.emis_number from DIABETIC_ISSUES_LAST d > inner join patients p on(d.emis_number = p.emis_number) > inner join gp_table g on(p.usual_gp_index_number = g.gp_id) > where d.emis_number not in(select DB.emis_number from DIABETICS DB) > >

[sqlite] Having issue working with SQLite & Windows Phone 8.1!

2015-03-22 Thread Sumesh Chandran
Hello all, I am working on SQLite with Windows Phone 8.1 and already having quite a few issues as of now. I am trying to insert some data dynamically to the table, when the app launches. This is the InnerException message that I get on launch " no such table: theScheduleClass" and the r