Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread Skip Evans
Thanks Puneet!!! > > SELECT '_' || startyear || '_' > FROM bsp_options > WHERE startyear LIKE '1990%' > > You results may look like so > > _1990 _ > > Notice the empty space after 1990? > > This was it! The client's csv file had an extra space at the end of the year. I didn't know this be

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread Skip Evans
D. Richard Hipp wrote: > On May 19, 2008, at 9:16 PM, Skip Evans wrote: > >> D. Richard Hipp wrote: >>> What does this show: >>> >>>SELECT DISTINCT typeof(startyear) FROM bsp_options; >>>SELECT DISTINCT typeof(endyear) FROM bsp_options; >>> >> I pasted those two statements into the SQL win

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread D. Richard Hipp
On May 19, 2008, at 9:16 PM, Skip Evans wrote: > D. Richard Hipp wrote: >> What does this show: >> >>SELECT DISTINCT typeof(startyear) FROM bsp_options; >>SELECT DISTINCT typeof(endyear) FROM bsp_options; >> > I pasted those two statements into the SQL window > and it returned: > > 2 quer

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread P Kishor
On 5/19/08, Skip Evans <[EMAIL PROTECTED]> wrote: > Hey all, > > Here's the table definition: > > CREATE TABLE bsp_options ( > optionsID INTEGER NOT NULL PRIMARY KEY, > modelID INT(11) NOT NULL, > startyear INT(11) NOT NULL, > endyear INT(11) NOT NULL, > options TEXT NOT NULL, > productcode

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread Skip Evans
I'm looking at the data in SQLiteAdmin, where I can just browse and see records that meet the criteria. I can search on modelID=351 to display the records, but then when I add "and startyear=1990 it returns no records, even though I can see with the first query records where this condition is

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread Skip Evans
Hey all, Here's the table definition: CREATE TABLE bsp_options ( optionsID INTEGER NOT NULL PRIMARY KEY, modelID INT(11) NOT NULL, startyear INT(11) NOT NULL, endyear INT(11) NOT NULL, options TEXT NOT NULL, productcodesize VARCHAR(10), productdesc VARCHAR(200), pattern VARCHAR(10) ); The insert

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread P Kishor
On 5/19/08, Skip Evans <[EMAIL PROTECTED]> wrote: > Even this statement > > SELECT * FROM bsp_options WHERE modelID=351 and > startyear=1990 > > Is returning no rows and I can clearly see dozens > that meet the criteria! If you are not getting rows returned, how can you clearly see dozens of r

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread P Kishor
On 5/19/08, Skip Evans <[EMAIL PROTECTED]> wrote: > What happens if the field in the table is defined > as int(11) but the insert command wraps the values > with single quotes? What do you mean by "insert command wraps the values with single quotes"? You can't wrap values with single quotes in a

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread Skip Evans
I don't have access to a command line tool. This server is at a client's hosting facility and I have no shell acess. BareFeet wrote: > Sorry, I left out a dot. It should be: > > .mode insert > select * from bsp_options where modelID=351; > > You enter tat using the command line tool. It will r

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread Skip Evans
Even this statement SELECT * FROM bsp_options WHERE modelID=351 and startyear=1990 Is returning no rows and I can clearly see dozens that meet the criteria! Here is the table def. I've recreated and repopulated them using int(11) for the year fields: CREATE TABLE bsp_options ( optionsID INTE

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread Skip Evans
What happens if the field in the table is defined as int(11) but the insert command wraps the values with single quotes? In MySQL this makes no difference. All the operations still work the same. Is SQLite different? Thanks! Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madi

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread Skip Evans
D. Richard Hipp wrote: > What does this show: > > SELECT DISTINCT typeof(startyear) FROM bsp_options; > SELECT DISTINCT typeof(endyear) FROM bsp_options; > I pasted those two statements into the SQL window and it returned: 2 query has been executed. 1.04 msec. 0 Line has been modified.

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread D. Richard Hipp
On May 19, 2008, at 9:03 PM, Skip Evans wrote: > Hey D. Richard & all, > > Casting them as int's also did not work. Here's > the schema: > > CREATE TABLE bsp_options > ( > optionsID INTEGER NOT NULL PRIMARY KEY, > modelID INT(11) NOT NULL, > startyear VARCHAR(4) NOT NULL DEFAULT '0', > endyear VA

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread BareFeet
Hi Skip, > I'm not sure what you mean by what is below: >> mode insert >> select * from bsp_options where modelID=351; >> > Is that two separate SQL statements? I'm testing all this using the > SQLiteAdmin tool, so do I paste > what you have above in the SQL window? I tried that and got an >

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread Skip Evans
Hey D. Richard & all, Casting them as int's also did not work. Here's the schema: CREATE TABLE bsp_options ( optionsID INTEGER NOT NULL PRIMARY KEY, modelID INT(11) NOT NULL, startyear VARCHAR(4) NOT NULL DEFAULT '0', endyear VARCHAR(4) NOT NULL DEFAULT '0', options TEXT NOT NULL, productcodesiz

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread Skip Evans
Hey, I'm not sure what you mean by what is below: BareFeet wrote: > Try this: > > mode insert > select * from bsp_options where modelID=351; > Is that two separate SQL statements? I'm testing all this using the SQLiteAdmin tool, so do I paste what you have above in the SQL window? I tried t

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread Skip Evans
Jay A. Kreibich wrote: > > Do you really mean for the years to be string literals and not numbers? > I've tried it both ways to no avail. -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread D. Richard Hipp
On May 19, 2008, at 8:42 PM, Skip Evans wrote: > Hey all, > > For the life of me I can't figure out why the > following statement returns no rows: > > SELECT productcodesize,options FROM bsp_options > WHERE modelID=351 AND '1990' >= startyear AND > '1990' <= endyear My guess is that you are stor

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread BareFeet
Hi Skip, Try this: mode insert select * from bsp_options where modelID=351; That will show us detail of how the data is stored, such as whether startyear and endyear are stored as text or numeric. If they are stored as numeric, but your query treats them as text, then that's your problem.

Re: [sqlite] Baffling SQLite statement

2008-05-19 Thread Jay A. Kreibich
On Mon, May 19, 2008 at 07:42:36PM -0500, Skip Evans scratched on the wall: > Hey all, > > For the life of me I can't figure out why the > following statement returns no rows: > > SELECT productcodesize,options FROM bsp_options > WHERE modelID=351 AND '1990' >= startyear AND > '1990' <= endyea