Re: [sqlite] UPDATE WITH ORDER BY LIMIT ERROR

2011-02-15 Thread Kees Nuyt
On Tue, 15 Feb 2011 03:30:23 -0800 (PST), venkat easwar
<hareas...@yahoo.com> wrote:

>Oh... Thanks Kennedy. Between any options on run time to enable the feature?

No, it's a compile-time option, compiling without
SQLITE_ENABLE_UPDATE_DELETE_LIMIT makes SQLite a bit lighter.

Without that feature, if you want to update one row, use it's unique
key in a WHERE clause. In your schema, it would make sense to create
the table like this:

create table check_update( 
a INTEGER PRIMARY KEY,
b TEXT,
c INTEGER
);

The INSERTs will stay the same, and the update statement becomes
something like:

UPDATE check_update
SET b='venkat n'
 WHERE a = (
SELECT min(a) 
  FROM check_update
 WHERE b='venkat'
);

Hpoe this helps.

>
>From: Dan Kennedy <danielk1...@gmail.com>
>To: sqlite-users@sqlite.org
>Sent: Tue, February 15, 2011 4:48:24 PM
>Subject: Re: [sqlite] UPDATE WITH ORDER BY LIMIT ERROR
>
>On 02/15/2011 06:04 PM, venkat easwar wrote:
>> Forgot to mention what error I am getting.
>>
>> near "order": syntax error
>> near "limit": syntax error - if i remove the order by clause
>
>See under the "Optional LIMIT and ORDER BY Clauses" heading
>on this page:
>
>  http://www.sqlite.org/lang_update.html
>
>You need to build SQLite with SQLITE_ENABLE_UPDATE_DELETE_LIMIT
>defined.
>
>  http://www.sqlite.org/compile.html#enable_update_delete_limit
-- 
  (  Kees Nuyt
  )
c[_]
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] UPDATE WITH ORDER BY LIMIT ERROR

2011-02-15 Thread venkat easwar
Oh... Thanks Kennedy. Between any options on run time to enable the feature?

 VENKAT





From: Dan Kennedy <danielk1...@gmail.com>
To: sqlite-users@sqlite.org
Sent: Tue, February 15, 2011 4:48:24 PM
Subject: Re: [sqlite] UPDATE WITH ORDER BY LIMIT ERROR

On 02/15/2011 06:04 PM, venkat easwar wrote:
> Forgot to mention what error I am getting.
>
> near "order": syntax error
> near "limit": syntax error - if i remove the order by clause

See under the "Optional LIMIT and ORDER BY Clauses" heading
on this page:

  http://www.sqlite.org/lang_update.html

You need to build SQLite with SQLITE_ENABLE_UPDATE_DELETE_LIMIT
defined.

  http://www.sqlite.org/compile.html#enable_update_delete_limit

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] UPDATE WITH ORDER BY LIMIT ERROR

2011-02-15 Thread Dan Kennedy
On 02/15/2011 06:04 PM, venkat easwar wrote:
> Forgot to mention what error I am getting.
>
> near "order": syntax error
> near "limit": syntax error - if i remove the order by clause

See under the "Optional LIMIT and ORDER BY Clauses" heading
on this page:

   http://www.sqlite.org/lang_update.html

You need to build SQLite with SQLITE_ENABLE_UPDATE_DELETE_LIMIT
defined.

   http://www.sqlite.org/compile.html#enable_update_delete_limit

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] UPDATE WITH ORDER BY LIMIT ERROR

2011-02-15 Thread venkat easwar
I apologize for multiple mails. In create I missed to add one column. The 
actual 
create statement is 


create table check_update( a int, b char, c int);
insert into check_update values (1,'venkat',22);
insert into check_update values (2,'venkat',23);

 
Failing query:

update check_update set b='venkat n' where b='venkat' order by a limit 1;

support link: http://www.sqlite.org/syntaxdiagrams.html#update-stmt-limited
VENKAT





From: venkat easwar <hareas...@yahoo.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Tue, February 15, 2011 4:34:21 PM
Subject: Re: [sqlite] UPDATE WITH ORDER BY LIMIT ERROR

Forgot to mention what error I am getting.

near "order": syntax error 
near "limit": syntax error - if i remove the order by clause

VENKAT





From: venkat easwar <hareas...@yahoo.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Tue, February 15, 2011 4:32:40 PM
Subject: [sqlite] UPDATE WITH ORDER BY LIMIT ERROR

Hi Buddies,

Sqlite support document says, update with limit and order by clauses are 
supported. But I found it actually not working. Sample DB schema,

create table check_update( a int, b char);
insert into check_update values (1,'venkat',22);
insert into check_update values (2,'venkat',23);

Now a update like this

update check_update set b='venkat n' where b='venkat' order by a limit 1;

should actually update the first row but not the second one as per document 
http://www.sqlite.org/syntaxdiagrams.html#update-stmt-limited 


The scenario is given just for reproduction, my actual scenes are different and 
which needs this implementation. :( 


Well, now am I missing something in the update.

VENKAT



  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] UPDATE WITH ORDER BY LIMIT ERROR

2011-02-15 Thread venkat easwar
Forgot to mention what error I am getting.

near "order": syntax error 
near "limit": syntax error - if i remove the order by clause

 VENKAT





From: venkat easwar <hareas...@yahoo.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Tue, February 15, 2011 4:32:40 PM
Subject: [sqlite] UPDATE WITH ORDER BY LIMIT ERROR

Hi Buddies,

Sqlite support document says, update with limit and order by clauses are 
supported. But I found it actually not working. Sample DB schema,

create table check_update( a int, b char);
insert into check_update values (1,'venkat',22);
insert into check_update values (2,'venkat',23);

Now a update like this

update check_update set b='venkat n' where b='venkat' order by a limit 1;

should actually update the first row but not the second one as per document 
http://www.sqlite.org/syntaxdiagrams.html#update-stmt-limited 


The scenario is given just for reproduction, my actual scenes are different and 
which needs this implementation. :( 


Well, now am I missing something in the update.

VENKAT



  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] UPDATE WITH ORDER BY LIMIT ERROR

2011-02-15 Thread venkat easwar
Hi Buddies,

Sqlite support document says, update with limit and order by clauses are 
supported. But I found it actually not working. Sample DB schema,

create table check_update( a int, b char);
insert into check_update values (1,'venkat',22);
insert into check_update values (2,'venkat',23);

Now a update like this

update check_update set b='venkat n' where b='venkat' order by a limit 1;

should actually update the first row but not the second one as per document 
http://www.sqlite.org/syntaxdiagrams.html#update-stmt-limited 


The scenario is given just for reproduction, my actual scenes are different and 
which needs this implementation. :( 


Well, now am I missing something in the update.

VENKAT



  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users