Thanks all. Actually I was just looking for the position of a single
name. Based on your feedback, this one works to get the results:
SELECT count(*) FROM clients WHERE name<'foo';
but its performance is directly proportional to the position of the name
in the table. For example, searching
And to correct myself one last time:
* A. Pagaltzis <[EMAIL PROTECTED]> [2006-05-03 00:30]:
> Assuming your client names are unique, this should work:
>
> SELECT
> (
> SELECT
> COUNT(*)
> FROM clients c2
> WHERE c2.name < c1.name
>
* A. Pagaltzis <[EMAIL PROTECTED]> [2006-05-03 00:30]:
> I tried to do it with a join to see if that would work better,
> but I’m too frazzled to figure it out right now.
I must be more frazzled than I thought.
SELECT
n1.name,
COUNT( n2.name ) rank
FROM names n1
CROSS
* JP <[EMAIL PROTECTED]> [2006-05-02 22:10]:
> SQLite provides a way to get the N-th row given a SQL statement, with
> LIMIT 1 and OFFSET .
>
> Can the reverse be done in an efficient way? For example, given a table
> with 1million names, how can I return the row number for a particular
> elem
* Kurt Welgehausen <[EMAIL PROTECTED]> [2006-05-02 22:15]:
> No, you can't do that in SQL.
You can.
> The results of an SQL query are a set of rows; the rows are not
> produced in any guaranteed order.
If this was true, how would `LIMIT` work?
Sure, the results do not have any implicit order, b
On 5/2/06, JP <[EMAIL PROTECTED]> wrote:
Can the reverse be done in an efficient way? For example, given a table
with 1million names, how can I return the row number for a particular
element? i.e. something like
is
select rowid from table where name = 'foo'
what you want?
JP <[EMAIL PROTECTED]> wrote:
> SQLite provides a way to get the N-th row given a SQL statement, with
> LIMIT 1 and OFFSET .
>
> Can the reverse be done in an efficient way? For example, given a table
> with 1million names, how can I return the row number for a particular
> element?
No, you c
SQLite provides a way to get the N-th row given a SQL statement, with
LIMIT 1 and OFFSET .
Can the reverse be done in an efficient way? For example, given a table
with 1million names, how can I return the row number for a particular
element? i.e. something like
SELECT rownum FROM
8 matches
Mail list logo