Re: [sqlite] Incremental row number associated to the current Query?
On Mon, 9 Aug 2010 17:53:02 -0500, Mike Henshawwrote: >>> Is there a way to create an incremental row or show a row number that is >>> linked to the current select query that can be used in >>> calculations? >> >>> Basically a row counter for the current query that can be used in >>> calculations. > >>Your application makes a series of sqlite3_step calls, one for each row. >>Can't it just increment a counter on each step? > >>> 2. The application is written in C/CPP so no counters or variables from >>> C/CPP can be used. > >>I don't see how the second statement follows from the first. In fact, it >>appears that just the opposite should be the case. > >1. The application is from a third party with no access to the source code but >the SQL query can be updated since the SQL query is used in a custom HTML >template which can also be updated. >2. The calculations to the RowNum would then have to be in the C/CPP >application which would nullify the use of customizable HTML template. > css will do that for you. = Demo file http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;> http://www.w3.org/1999/xhtml; xml:lang="en" lang="en"> Test pages table { counter-reset: line-number; } td:first-child:before { content: counter(line-number) "."; counter-increment: line-number; padding-right: 0.3em; } #. col1col2 val1.1val1.2 val2.1val2.1 val3.1val3.2 === EOF === -- ( Kees Nuyt ) c[_] ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Incremental row number associated to the current Query?
Mike Henshawwrote: > 1. The application is from a third party with no access to the source code > but the SQL query can be updated since the SQL query > is used in a custom HTML template which can also be updated. > 2. The calculations to the RowNum would then have to be in the C/CPP > application which would nullify the use of customizable HTML > template. What kind of template language is being used? Many of them have a built-in way to number rows, or implement alternate coloring (the motivation for your second example, I suspect). There is no built-in mechanism in SQLite for this kind of row numbering. Implementing it in SQL query is very inefficient, and is outright impossible if the resultset needs to contain duplicate rows. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Incremental row number associated to the current Query?
>> Is there a way to create an incremental row or show a row number that is >> linked to the current select query that can be used in >> calculations? > >> Basically a row counter for the current query that can be used in >> calculations. >Your application makes a series of sqlite3_step calls, one for each row. Can't >it just increment a counter on each step? >> 2. The application is written in C/CPP so no counters or variables from >> C/CPP can be used. >I don't see how the second statement follows from the first. In fact, it >appears that just the opposite should be the case. 1. The application is from a third party with no access to the source code but the SQL query can be updated since the SQL query is used in a custom HTML template which can also be updated. 2. The calculations to the RowNum would then have to be in the C/CPP application which would nullify the use of customizable HTML template. Have a dynamite day. Michael Henshaw AdCom Technologies Inc. 1119 Superior Ave. Sheboygan, WI 53081 (920) 694-0039 http://www.adcomtechnologies.com/ -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik Sent: Monday, August 09, 2010 5:25 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Incremental row number associated to the current Query? Mike Henshaw <mhens...@adcomtechnologies.com> wrote: > Is there a way to create an incremental row or show a row number that is > linked to the current select query that can be used in > calculations? > > Basically a row counter for the current query that can be used in > calculations. Your application makes a series of sqlite3_step calls, one for each row. Can't it just increment a counter on each step? > 2. The application is written in C/CPP so no counters or variables from C/CPP > can be used. I don't see how the second statement follows from the first. In fact, it appears that just the opposite should be the case. -- Igor Tandetnik ___ 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] Incremental row number associated to the current Query?
Mike Henshawwrote: > Is there a way to create an incremental row or show a row number that is > linked to the current select query that can be used in > calculations? > > Basically a row counter for the current query that can be used in > calculations. Your application makes a series of sqlite3_step calls, one for each row. Can't it just increment a counter on each step? > 2. The application is written in C/CPP so no counters or variables from C/CPP > can be used. I don't see how the second statement follows from the first. In fact, it appears that just the opposite should be the case. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users