Re: [sqlite] Query problem

2008-01-23 Thread Jay Sprenkle
You need single quotes for text literals. On Jan 23, 2008 6:15 AM, Yasir Nisar <[EMAIL PROTECTED]> wrote: > SELECT * FROM BackupTable,BackupItemTable,BackItUpPathTable WHERE > lower(BackItUpPathTable.WinName) GLOB lower("*1[]1.txt*") AND > BackupItemTable.BKItemSize > -1 AND BackupTable.Backup

Re: [sqlite] Query problem

2008-01-23 Thread Dennis Cote
Yasir Nisar wrote: Hi, Hope you will find this mail in the best of your health. SELECT * FROM BackupTable,BackupItemTable,BackItUpPathTable WHERE lower(BackItUpPathTable.WinName) GLOB lower("*1[]1.txt*") AND BackupItemTable.BKItemSize > -1 AND BackupTable.BackupNo = BackupItemTable.Bac

Re: [sqlite] Query problem

2008-01-23 Thread drh
Dennis Cote <[EMAIL PROTECTED]> wrote: >> > SQLite seems to do the following: > > The glob syntax supports the following patterns: > ? - matches any single character > * - matches zero or more characters > [seq] - matches any single character in seq > [!seq] - matches any

Re: [sqlite] Query problem

2008-01-23 Thread drh
[EMAIL PROTECTED] wrote: > > > This appears to be slightly different than normal *nix globbing since > > SQLite uses '^' rather than '!' for the set inversion (if my reading of > > the source is correct). > > GLOB is suppose to exactly mimic Unix, except that SQLite does not > break pattern match

RE: [sqlite] Query problem

2008-01-23 Thread James Dennett
DRH wrote: > > Experiments using bash indicate that either ^ or ! is accepted > as the negation of a character set. Hence, > > ls -d [^tu]* > ls -d [!tu]* > > both return the same thing - a list of all files and directories > in the current directory whose names do not begin with "t" or

Re: [sqlite] Query problem

2008-01-23 Thread Nicolas Williams
On Wed, Jan 23, 2008 at 09:38:06PM +, [EMAIL PROTECTED] wrote: > Experiments using bash indicate that either ^ or ! is accepted > as the negation of a character set. Hence, > > [...] > > Anybody have an old Bourne shell around? An authentic C-shell? > What do they do? The Bourne Shell uses

Re: [sqlite] Query problem

2008-01-23 Thread Dennis Cote
[EMAIL PROTECTED] wrote: You can escape characters using [..]. To match a * anywhere in a string, for example: x GLOB '*[*]*' The [..] pattern must contain at least one internal character. So to match a "]" you can use the pattern x GLOB '*[]]*' So to match the OP's original string he would

Re: [sqlite] Query problem

2008-01-23 Thread John Stanton
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: This appears to be slightly different than normal *nix globbing since SQLite uses '^' rather than '!' for the set inversion (if my reading of the source is correct). GLOB is suppose to exactly mimic Unix, except that SQLite does not break patter

RE: [sqlite] Query problem

2008-01-23 Thread James Dennett
> -Original Message- > From: Dennis Cote [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 23, 2008 2:22 PM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Query problem > > [EMAIL PROTECTED] wrote: > > > > You > > can escape characters

Re: [sqlite] Query problem

2008-01-23 Thread Dennis Cote
[EMAIL PROTECTED] wrote: Experiments using bash indicate that either ^ or ! is accepted as the negation of a character set. Hence, ls -d [^tu]* ls -d [!tu]* both return the same thing - a list of all files and directories in the current directory whose names do not begin with "t" or "

Re: [sqlite] Query problem

2008-01-23 Thread Dennis Cote
James Dennett wrote: Square brackets don't "escape" thing that way: [[] is a character class containing only the character '['. [][], however, is a character class containing two characters. The special rule is that the first character after the opening '[' is part of the class even if it's a

RE: [sqlite] Query problem

2008-01-23 Thread James Dennett
> -Original Message- > From: Dennis Cote [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 23, 2008 3:08 PM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Query problem > > James Dennett wrote: > > > > Square brackets don't "escap

Re: [sqlite] Query problem

2008-01-23 Thread Dennis Cote
James Dennett wrote: The POSIX/Single Unix Spec documentation for fnmatch might be a good source, but I agree with the idea that SQLite should just document what it does rather than assuming that there's a universal standard for globbing. I think the most direct documentation I have found so

Re: [sqlite] Query problem

2008-01-23 Thread Scott Hess
On Wed, Jan 23, 2008 at 3:23 PM, James Dennett <[EMAIL PROTECTED]> wrote: > The POSIX/Single Unix Spec documentation for fnmatch might be a good > source, but I agree with the idea that SQLite should just document what > it does rather than assuming that there's a universal standard for > globb

Re: [sqlite] Query problem

2008-01-24 Thread Nicolas Williams
On Wed, Jan 23, 2008 at 10:24:53PM -0800, Scott Hess wrote: > Seems to me that GLOB is a poor substitute for REGEXP. At the shell If, as I suspect, many more users can enter simple globs than can enter simple regexps, then providing a GLOB operator and function in SQLite is very useful indeed. O

Re: [sqlite] Query problem

2008-01-25 Thread Yasir Nisar
I am really thankful to all of you who replied my query and helped solve my problem. Again thank you very much. Best Regards, Yasir Nisar - Looking for last minute shopping deals? Find them fast with Yahoo! Search.

Re: [sqlite] query problem

2005-09-19 Thread Puneet Kishor
On Sep 19, 2005, at 12:36 PM, Alain Bertrand wrote: hi all, I am porting a program from mysql to sqlite. The following statement doesn't work correctly with sqlite though it does with mysql. SELECT COUNT(*) AS nb FROM ttd_photos LEFT JOIN ttd_trees ON ttd_photos.kind=1 AND ttd_photos.refId=t

Re: [sqlite] query problem

2005-09-19 Thread D. Richard Hipp
On Mon, 2005-09-19 at 19:36 +0200, Alain Bertrand wrote: > hi all, > > I am porting a program from mysql to sqlite. > The following statement doesn't work correctly with sqlite though it does > with mysql. > SELECT COUNT(*) AS nb FROM ttd_photos LEFT JOIN ttd_trees ON > ttd_photos.kind=1 AND ttd_p

Re: [sqlite] query problem

2005-09-19 Thread Kervin L. Pierre
D. Richard Hipp wrote: Hence, the result set contains no rows. A COUNT() of a empty result set gives NULL. I thought per the last discussion on "Sum and NULL" that the count of an empty set would return zero. Regards, Kervin

Re: [sqlite] query problem

2005-09-19 Thread D. Richard Hipp
On Mon, 2005-09-19 at 16:06 -0400, Kervin L. Pierre wrote: > D. Richard Hipp wrote: > > Hence, the result set contains no rows. A COUNT() of a empty result > > set gives NULL. > > I thought per the last discussion on "Sum and NULL" > that the count of an empty set would return zero. > You're ri

Re: [sqlite] query problem

2005-09-19 Thread D. Richard Hipp
On Mon, 2005-09-19 at 15:19 -0400, D. Richard Hipp wrote: > On Mon, 2005-09-19 at 19:36 +0200, Alain Bertrand wrote: > > hi all, > > > > I am porting a program from mysql to sqlite. > > The following statement doesn't work correctly with sqlite though it does > > with mysql. > > SELECT COUNT(*) AS

RE: [sqlite] query problem

2005-09-19 Thread Cariotoglou Mike
hat restricts the RIGHT hand table only. Just a thought. > -Original Message- > From: D. Richard Hipp [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 20, 2005 12:07 AM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] query problem > > I've changed my mind. I

Re: [sqlite] Query problem

2004-01-19 Thread D. Richard Hipp
Simon Berthiaume wrote: SELECT * FROM ( ( SELECT * from INSCLAIMS ) AS T0 LEFT JOIN ( SELECT * FROM INSCLAIMS_CONCAT WHERE ( INSCLAIMS_CONCAT_FIELD_ID = 'INSCLAIMS_POLICYNO' ) ) AS T1 ON T1.INSCLAIMS_ID = T0.

Re: [sqlite] Query problem

2004-01-19 Thread Simon Berthiaume
Actualy none, there was an error in the statement I copied. But the following works on Access (ADO) and Oracle as well, but not on SQLite. Since I don't have access to any other RDBMS, I couldn't test others. SELECT * FROM ( ( SELECT * from INSCLAIMS ) AS T0 LEFT JOIN

Re: [sqlite] Query problem

2004-01-19 Thread Kurt Welgehausen
If you look at the SQLite grammar in lang.html, you'll see that parentheses are not allowed around a table-list. That's why you're getting an error. If you remove either of the first 2 left parens (and its corresponding right paren), the query will work, but the outer select and the first subsele

Re: [sqlite] Query problem

2004-01-19 Thread Simon Berthiaume
Maybe I used a too simplistic example. I have code that generates SQL queries so users can request reports with various fields, various criterias and various sorting orders. So technicaly there can be 1,2,3,N inner queries with various statements in them. Here is an example of a more complex query:

Re: [sqlite] Query problem

2004-01-21 Thread Simon Berthiaume
For those of you that tends to write complex queries, I noted that SQLite doesn't like when a table name follows a opening parenthesis in the FROM clause. For example, the following works under Access ans Oracle, but not in SQLite: SELECT T0.OBJECTS_ID , T0.OBJECTS_REFNO, T8.OBJECTS_LOCATION_LOCATI

Re: [sqlite] Query problem

2004-01-21 Thread D. Richard Hipp
Simon Berthiaume wrote: For those of you that tends to write complex queries, I noted that SQLite doesn't like when a table name follows a opening parenthesis in the FROM clause. The simplest fix for this would be to insert "SELECT * FROM" right after the "(" in the FROM list. So, if the original

Re: [sqlite] Query problem

2004-01-21 Thread D. Richard Hipp
D. Richard Hipp wrote: Simon Berthiaume wrote: For those of you that tends to write complex queries, I noted that SQLite doesn't like when a table name follows a opening parenthesis in the FROM clause. The simplest fix for this would be to insert "SELECT * FROM" right after the "(" in the FROM

[sqlite] Re: - Re: [sqlite] query problem

2005-09-19 Thread rbundy
sqlite-users@sqlite.org | | cc: | | Subject: - R

Re: [sqlite] Query Problem when Executed from PHP v5.2.9-2

2010-02-09 Thread Sebastian Bermudez
try : $strQuery ="SELECT CASE WHEN substr(substr(eTimeStart,1,2),-1) =\':\' THEN substr(eTimeStart,1,1)||substr(etimeStart,3,2) ELSE substr(eTimeStart,1,2)||substr(eTimeStart,4,2) END as aTIME FROM EVENTS WHERE Cast(eMonth as int)= 2 AND CAST(eYear as INT)=2010 and CAST(eDay as INT)=13 OR