Re: [sqlite] help with sqlite command

2006-03-28 Thread Walter Meerschaert
Dennis Cote wrote: To get every N'th row after deletions you need some way to assign a series of integers to the result rows. The easiest way I can think of is to create a temporary table from your initial query. Then you can use the modulus operator to select every N'th record from that table

Re: [sqlite] help with sqlite command

2006-03-27 Thread Jay Sprenkle
On 3/27/06, Uma Venkataraman <[EMAIL PROTECTED]> wrote: > I would like to delete n records from a table, based on some condition. Can > some one please let me know how to do this with sqlite? http://sqlite.org/lang_delete.html

Re: [sqlite] help with sqlite command

2006-03-27 Thread Srikanth Mudigonda
The following statement should help: delete from "table_name" where "condition"; Of course, you'd make appropriate substitutions for "table_name" and "condition". HTH On 3/27/06, Uma Venkataraman <[EMAIL PROTECTED]> wrote: > > I would like to delete n records from a table, based on some conditio

Re: [sqlite] help with sqlite command

2006-03-27 Thread Uma Venkataraman
I would like to delete n records from a table, based on some condition. Can some one please let me know how to do this with sqlite? Thanks

Re: [sqlite] help with sqlite command

2006-03-27 Thread Uma Venkataraman
Thanks Dennis..that seems to do the trick... - Original Message - From: "Dennis Cote" <[EMAIL PROTECTED]> To: Sent: Monday, March 27, 2006 2:46 PM Subject: Re: [sqlite] help with sqlite command Jay Sprenkle wrote: I believe rowid is assigned dynamically to the

Re: [sqlite] help with sqlite command

2006-03-27 Thread Jay Sprenkle
Too bad sqlite doesn't have Oracle's ROWNUM: "Pseudo-Columns While not actual datatypes, Oracle supports several special-purpose data elements. These elements are not actually contained in a table, but are available for use in SQL statements as though they were part of the table. ROWNUM For each

Re: [sqlite] help with sqlite command

2006-03-27 Thread Jay Sprenkle
On 3/27/06, Dennis Cote <[EMAIL PROTECTED]> wrote: > Jay, > > The rowid is the key from the btree used to store the table rows. It is > not generated dynamically. Ah. Thanks! Learn something new every day.

Re: [sqlite] help with sqlite command

2006-03-27 Thread Dennis Cote
Jay Sprenkle wrote: I believe rowid is assigned dynamically to the result set so it would give a different set of results for a different query. Jay, The rowid is the key from the btree used to store the table rows. It is not generated dynamically. To get every N'th row after deletion

Re: [sqlite] help with sqlite command

2006-03-27 Thread Derrell . Lipman
"Uma Venkataraman" <[EMAIL PROTECTED]> writes: > Hi Jay, > > Thanks for your reply. I am trying the command > >select * from mytable where row_id = row_id % 5 Try this instead: SELECT * FROM mytable WHERE ROWID % 5 = 0; Note that if you have an integer primary key in mytable, then ROWID a

Re: [sqlite] help with sqlite command

2006-03-27 Thread Clark Christensen
Clark - Original Message From: Uma Venkataraman <[EMAIL PROTECTED]> To: sqlite-users@sqlite.org Sent: Monday, March 27, 2006 11:07:18 AM Subject: Re: [sqlite] help with sqlite command Hi Jay, Thanks for your reply. I am trying the command select * from mytable where row_id =

Re: [sqlite] help with sqlite command

2006-03-27 Thread Jay Sprenkle
> Thanks for your reply. I am trying the command > > select * from mytable where row_id = row_id % 5 > > from sqlite browser and it says, no such column row_id.. Also I replaced > row_id with rowid and it gave only the first 4 records from my table. My > other concern is I will be deleting and

Re: [sqlite] help with sqlite command

2006-03-27 Thread Uma Venkataraman
adding records to the table. If I want to select every nth record after such deletions and additions will the row id not get affected? Thanks Uma - Original Message - From: "Jay Sprenkle" <[EMAIL PROTECTED]> To: Sent: Monday, March 27, 2006 1:56 PM Subject: Re: [s

Re: [sqlite] help with sqlite command

2006-03-27 Thread Jay Sprenkle
On 3/27/06, Uma Venkataraman <[EMAIL PROTECTED]> wrote: > Hi All, > > I need to be able to select the TOP N rows from a table. How do i do it = select * from mytable limit 5 > with sqlite? Also how does one select EVERY Nth row from a table? use modulus operator for that: select * from mytabl

[sqlite] help with sqlite command

2006-03-27 Thread Uma Venkataraman
Hi All, I need to be able to select the TOP N rows from a table. How do i do it = with sqlite? Also how does one select EVERY Nth row from a table? Thanks