hi ragha, On 29/08/2007, RaghavendraK 70574 <[EMAIL PROTECTED]> wrote: > Hi, > > There are 2 testcases one works and other fails > Hope am clear. >
It is only clear that you are misunderstanding the operation of the 'like' operator. See Igor's post for explanation... Rgds, Simon On 29/08/2007, RaghavendraK 70574 <[EMAIL PROTECTED]> wrote: > Hi, > > There are 2 testcases one works and other fails > Hope am clear. > > SqliteVersion: 3.4.0 > > TestCase 1: works > > create table test(t text); > > insert into test values ('9'); > insert into test values('98'); > insert into test values('983'); > insert into test values('9854'); > > select * from test where '982' like t || '%' order by t desc limit 1; > > output: 98 [correct] > > TestCase 2: does not work > create table 'tbl.7'(ver integer, > column1 text not NULL, > column2 text not NULL, > column3 text not NULL, > column4 text not NULL, > column5 text not NULL, > column6 text not NULL, > column7 text not NULL, > column8 text not NULL, > column9 text not NULL, > column10 text not NULL, > primary > key(ver,column1,column2,column3,column4,column5)); > > insert into 'tbl.7' > values > (7, '9845002655', '1', '1', '1', '1','x','x','x', > 'x','x'); > > insert into 'tbl.7' > values > (7, '9855002655', '1', '1', '1', '1','x','x','x', > 'x','x'); > > --Best match for 985 shd be 9855002655 > select * from 'tbl.7' where '985' like column1 || '%' order by column1 desc > limit 1; > > output: none //this is a bug. > > ****************************************************************************************** > This email and its attachments contain confidential information from HUAWEI, > which is intended only for the person or entity whose address is listed > above. Any use of the information contained herein in any way (including, but > not limited to, total or partial disclosure, reproduction, or dissemination) > by persons other than the intended recipient(s) is prohibited. If you receive > this e-mail in error, please notify the sender by phone or email immediately > and delete it! > > ***************************************************************************************** > > ----- Original Message ----- > From: Simon Davies <[EMAIL PROTECTED]> > Date: Wednesday, August 29, 2007 7:39 pm > Subject: Re: [sqlite] BestMatch and SqliteStatment Clash > > > On 29/08/2007, RaghavendraK 70574 <[EMAIL PROTECTED]> wrote: > > > > > > select * from test where '982' like t || '%' order by t desc > > limit 1; > > > > > > This works but will not work for earlier data(9854002656).So > > seems to be bug. > > > > > > regards > > > ragha > > > > '9854002656%' is not a match for '982', so seems not to be a bug > > > > Rgds, > > Simon > > > > -------------------------------------------------------------------- > > --------- > > To unsubscribe, send email to [EMAIL PROTECTED] > > -------------------------------------------------------------------- > > --------- > > > > > > ----------------------------------------------------------------------------- > To unsubscribe, send email to [EMAIL PROTECTED] > ----------------------------------------------------------------------------- > > ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------