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, productcodesize VARCHAR(10), productdesc VARCHAR(200), pattern VARCHAR(10) ); D. Richard Hipp wrote: > 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 storing endyear as an integer within a column > with no affinity. And an integer is always less than a string so > '1990'<=endyear is always false. What is your table schema? Have you > tried: > > WHERE modelID=351 AND CAST(startyear AS INT)<=1990 AND CAST(endyear > AS INT)>=1999 > >> >> I'm looking right now at a printout of records >> from the query: >> SELECT productcodesize,options FROM bsp_options >> WHERE modelID=351 >> >> Where the fields are: >> >> modelID: 351 startyear: 1990 endyear:1993 >> >> ..and there are a bunch of them. >> >> Can anyone spot anything wrong with that query??? >> >> Thanks! >> >> -- >> Skip Evans >> Big Sky Penguin, LLC >> 503 S Baldwin St, #1 >> Madison, WI 53703 >> 608-250-2720 >> http://bigskypenguin.com >> =-=-=-=-=-=-=-=-=-= >> Check out PHPenguin, a lightweight and versatile >> PHP/MySQL, AJAX & DHTML development framework. >> http://phpenguin.bigskypenguin.com/ >> _______________________________________________ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > > D. Richard Hipp > [EMAIL PROTECTED] > > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX & DHTML development framework. http://phpenguin.bigskypenguin.com/ _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users