Re: Variable for row number?

2010-03-15 Thread Pavel Gulchouck
On Sun, Mar 14, 2010 at 06:25:31PM -0400, Shawn Green writes: SG I know it's bad form to reply to yourself but I spotted something I SG could clarify Thank you very much, it works good enough in this case! SG Shawn Green wrote: ... One way to do this is to materialize the results of the

Re: Variable for row number?

2010-03-14 Thread Shawn Green
Pavel Gulchouck wrote: On Fri, Mar 12, 2010 at 11:37:16PM +0100, Carsten Pedersen writes: CP Pavel Gulchouck skrev: Is there any way to get sequence row number in request? I need row number calculated before having but after group by and order, so select @row := @row+1 unsuitable in my case

Re: Variable for row number?

2010-03-14 Thread Shawn Green
I know it's bad form to reply to yourself but I spotted something I could clarify Shawn Green wrote: ... One way to do this is to materialize the results of the ORDER BY into a temporary table with an auto_increment column defined on it. Then just do a query against the temporary table with

Variable for row number?

2010-03-12 Thread Pavel Gulchouck
Hi! Is there any way to get sequence row number in request? I need row number calculated before having but after group by and order, so select @row := @row+1 unsuitable in my case (it executed before grouping). -- Pavel -- MySQL General Mailing List For list archives: http://lists.mysql.com

Re: Variable for row number?

2010-03-12 Thread Carsten Pedersen
Pavel Gulchouck skrev: Hi! Is there any way to get sequence row number in request? I need row number calculated before having but after group by and order, so select @row := @row+1 unsuitable in my case (it executed before grouping). something along the lines of this: mysql select * from t

Re: Variable for row number?

2010-03-12 Thread Pavel Gulchouck
On Fri, Mar 12, 2010 at 11:37:16PM +0100, Carsten Pedersen writes: CP Pavel Gulchouck skrev: Is there any way to get sequence row number in request? I need row number calculated before having but after group by and order, so select @row := @row+1 unsuitable in my case (it executed before

Re: Can a row be refered using row number?

2006-08-11 Thread Andrew Kreps
The reason for this is probably because the original poster inherited a database without a primary key, and now needs to make edits to it. That happened to me with Oracle once, and I was lucky enough to be able to use Oracle's rowid, which is a unique reference to the row that is independent of

Can a row be refered using row number?

2006-08-10 Thread ravi.karatagi
Hi All, Is there any way to refer a row based on the row number or row count? I just the effect as below... E.g. UPDATE TBL_NAME SET COL_NAME = xyz WHERE ROW_NO=4 Or SELECT COL_NAME FROM TBL_NAME WHERE ROW_NO=5 Regards, Ravi K The information contained

Re: Can a row be refered using row number?

2006-08-10 Thread mos
At 03:43 AM 8/10/2006, you wrote: Hi All, Is there any way to refer a row based on the row number or row count? I just the effect as below... E.g. UPDATE TBL_NAME SET COL_NAME = xyz WHERE ROW_NO=4 Or SELECT COL_NAME FROM TBL_NAME WHERE ROW_NO=5 Regards, Ravi K Ravi

RE: Can a row be refered using row number?

2006-08-10 Thread Bartis, Robert M (Bob)
] [mailto:[EMAIL PROTECTED] Sent: Thursday, August 10, 2006 4:43 AM To: mysql@lists.mysql.com Subject: Can a row be refered using row number? Hi All, Is there any way to refer a row based on the row number or row count? I just the effect as below... E.g. UPDATE TBL_NAME SET COL_NAME

Re: Can a row be refered using row number?

2006-08-10 Thread John Meyer
Bartis, Robert M (Bob) wrote: Why would you want to do this? As data moves around within the table the updates will be in error. Wouldn't it be easier to assign a unique key to each row, search for the key or unique set of information and update the resulting row? Bob I don't know,

Re: Can a row be refered using row number?

2006-08-10 Thread Paul DuBois
At 14:13 +0530 8/10/06, [EMAIL PROTECTED] wrote: Hi All, Is there any way to refer a row based on the row number or row count? I just the effect as below... E.g. UPDATE TBL_NAME SET COL_NAME = xyz WHERE ROW_NO=4 Or SELECT COL_NAME FROM TBL_NAME WHERE ROW_NO=5 No, because

Re: Help with query: Row number / Rank from a query...

2006-06-02 Thread Dan
Thanks Peter, That looks pretty good to me. I never would have figured that out on my own. Dan T On Jun 1, 2006, at 4:06 PM, Peter Brawley wrote: Dan, I want to get a particular users 'rank' or row number from the query. SELECT 1+COUNT(*) AS Rank FROM results r1 INNER JOIN results r2

Help with query: Row number / Rank from a query...

2006-06-01 Thread Dan
I have a regular query lets say: SELECT user, points FROM results ORDER BY points DESC so I get: userpoints --- john23 steve 17 bill14 From this I want to get a particular users 'rank' or row number from the query. I was hoping for a single line elegant query

Re: Help with query: Row number / Rank from a query...

2006-06-01 Thread Michael Stassen
a solution to your real problem. We need the real query to give a real answer. SELECT user, points FROM results ORDER BY points DESC so I get: userpoints --- john23 steve 17 bill14 From this I want to get a particular users 'rank' or row number from the query. I

Re: Help with query: Row number / Rank from a query...

2006-06-01 Thread Peter Brawley
Dan, I want to get a particular users 'rank' or row number from the query. SELECT 1+COUNT(*) AS Rank FROM results r1 INNER JOIN results r2 ON r1.pointsr2.points WHERE r1.user='Steve'; PB - Dan wrote: I have a regular query lets say: SELECT user, points FROM results ORDER BY points DESC

Trans.: RE: [SPAM] - Trans.: Re: Finding the row number satisfying a conditon in a result set - Bayesian Filter detected spam

2006-01-31 Thread Jacques Brignon
number satisfying a conditon in a result set - Bayesian Filter detected spam À : Gordon Bruce [EMAIL PROTECTED] Thanks. That looks OK from the point of view of generating the row number. But when this is done if my result set is tens of thousands row long, how do I find the row number

Trans.: Re: Trans.: Re: Finding the row number satisfying a conditon in a result set

2006-01-31 Thread Jacques Brignon
- Message transféré de Jacques Brignon [EMAIL PROTECTED] - Date : Tue, 31 Jan 2006 13:52:16 +0100 De : Jacques Brignon [EMAIL PROTECTED] Adresse de retour :Jacques Brignon [EMAIL PROTECTED] Sujet : Re: Trans.: Re: Finding the row number satisfying a conditon in a result set

Fw: Trans.: Re: Finding the row number satisfying a conditon in a result set

2006-01-31 Thread SGreen
Oops - I too forgot the list! - Forwarded by Shawn Green/Unimin on 01/31/2006 09:19 AM - Shawn Green/Unimin 01/31/2006 09:06 AM To Jacques Brignon [EMAIL PROTECTED] cc Subject Re: Trans.: Re: Finding the row number satisfying a conditon in a result set Thank you for your response

Finding the row number satisfying a conditon in a result set

2006-01-30 Thread Jacques Brignon
I would like some advice on the various and best ways of finding the rank of the row which satisfies a given condition in a rsult set. Let's assume that the result set includes a field containing an identifier from one of the table used in the query and that not two rows have the same value for

Re: Finding the row number satisfying a conditon in a result set

2006-01-30 Thread Jake Peavy
set, until the number is found to get the rank of the row. That does not seem very clever and it can be very time consuming if the set has a lot of rows. use ORDER BY with a LIMIT of 1 your subject line needs work though - a row number has no meaning in a relational database. -jp

Trans.: Re: Finding the row number satisfying a conditon in a result set

2006-01-30 Thread Jacques Brignon
the row number satisfying a conditon in a result set À : Jake Peavy [EMAIL PROTECTED] Selon Jake Peavy [EMAIL PROTECTED]: On 1/30/06, Jacques Brignon [EMAIL PROTECTED] wrote: I would like some advice on the various and best ways of finding the rank of the row which satisfies

RE: [SPAM] - Trans.: Re: Finding the row number satisfying a conditon in a result set - Bayesian Filter detected spam

2006-01-30 Thread Gordon Bruce
@lists.mysql.com Subject: [SPAM] - Trans.: Re: Finding the row number satisfying a conditon in a result set - Bayesian Filter detected spam Oops! forgoten to include the list in the relply -- Jacques Brignon - Message transféré de Jacques Brignon [EMAIL PROTECTED] - Date : Mon, 30 Jan 2006 16:16

Re: Trans.: Re: Finding the row number satisfying a conditon in a result set

2006-01-30 Thread SGreen
] Adresse de retour :Jacques Brignon [EMAIL PROTECTED] Sujet : Re: Finding the row number satisfying a conditon in a result set À : Jake Peavy [EMAIL PROTECTED] Selon Jake Peavy [EMAIL PROTECTED]: On 1/30/06, Jacques Brignon [EMAIL PROTECTED] wrote: I would like some advice

row number discrepancy while enabling keys

2006-01-30 Thread Michael Chester
Hi, Can anyone point me in the right direction to find out why I keep getting the following error? The table is newly created and then 14 LOAD DATA calls are made to load approximately 24-30 million rows. Its a simple MyISAM table, no triggers, proceedures etc with a couple of simple

Show row number

2006-01-25 Thread Clyde Lewis
Is there a command in mysql that will return the row number. I tried rownum and rownum()

Re: Show row number

2006-01-25 Thread SGreen
Clyde Lewis [EMAIL PROTECTED] wrote on 01/25/2006 01:41:30 PM: Is there a command in mysql that will return the row number. I tried rownum and rownum() No, rows do not exist in the base data of a MySQL database. They are called records and records may be stored in any order. Within some

Re: Show row number

2006-01-25 Thread Clyde Lewis
Excellent explanation. Thanks again. CL At 02:00 PM 1/25/2006, [EMAIL PROTECTED] wrote: Clyde Lewis [EMAIL PROTECTED] wrote on 01/25/2006 01:41:30 PM: Is there a command in mysql that will return the row number. I tried rownum and rownum() No, rows do not exist in the base data

RE: Show row number

2006-01-25 Thread Little, Tim
To: [EMAIL PROTECTED] Cc: MySQL List Subject: Re: Show row number Excellent explanation. Thanks again. CL At 02:00 PM 1/25/2006, [EMAIL PROTECTED] wrote: Clyde Lewis [EMAIL PROTECTED] wrote on 01/25/2006 01:41:30 PM: Is there a command in mysql that will return the row number. I tried rownum

Re: How do I determine the row number or key when table has no key fields

2004-04-12 Thread Kevin Carlson
Andy Ford wrote: I thought LIMIT limited you to N number of CONCURRENT record. ie. limit 10 or limit 20 I believe Ross would like to select select 1000 records and then do a sub select of records 1-20 and then 21-40 on this record set LIMIT also allows you to specify a starting record, i.e.

How do I determine the row number or key when table has no key

2004-04-03 Thread Khashan
It seems to me you want to retrive n records based on the page number the user is in. Here is what i use to page $limit records at a time using PHP: $sql_select = SELECT * FROM myTableName limit $offset , $limit; $result = mysql_query($sql_select) or die (Queryproblem: . mysql_error()); I

How do I determine the row number or key when table has no key fields

2004-04-02 Thread Ross Honniball
eg. say a table is created using: create table fred (f1 char(10), f2 int) Then it has neither keys nor an AUTO_INCREMENT field. Let's say 1000,000 records are then inserted into table fred. I then say 'select * from fred' and loop through results writing to a web page. I stop writing to

Re: How do I determine the row number or key when table has no key

2004-04-02 Thread Terry Riley
Take a look at LIMIT in the Manual Cheers Terry --Original Message- eg. say a table is created using: create table fred (f1 char(10), f2 int) Then it has neither keys nor an AUTO_INCREMENT field. Let's say 1000,000 records are then inserted into table fred. I

RE: How do I determine the row number or key when table has no key fields

2004-04-02 Thread Andy Eastham
, then reload the data. Find more information in the manual at http://www.mysql.com/doc/en/index.html Andy -Original Message- From: Ross Honniball [mailto:[EMAIL PROTECTED] Sent: 02 April 2004 13:48 To: [EMAIL PROTECTED] Subject: How do I determine the row number or key when table has no key

RE: How do I determine the row number or key when table has no key fields

2004-04-02 Thread Andy Ford
an autoincrement column, then reload the data. Find more information in the manual at http://www.mysql.com/doc/en/index.html Andy -Original Message- From: Ross Honniball [mailto:[EMAIL PROTECTED] Sent: 02 April 2004 13:48 To: [EMAIL PROTECTED] Subject: How do I determine the row number

RE: How do I determine the row number or key when table has no keyfields

2004-04-02 Thread Andy Eastham
number of rows to return. The offset of the initial row is 0 (not 1): mysql SELECT * FROM table LIMIT 5,10; # Retrieve rows 6-15 -Original Message- From: Andy Ford [mailto:[EMAIL PROTECTED] Sent: 01 April 2004 05:53 To: [EMAIL PROTECTED] Subject: RE: How do I determine the row number or key

Re: Row Number

2003-06-05 Thread Paul Najman
: Anthony Ward [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 02, 2003 6:21 PM Subject: Row Number Hi, If i have a table with just Userid,Name,Language where userid is primary key. now if i search the first 10 people that speaks english i.e SELECT * FROM tablex WHERE language

Row Number

2003-06-03 Thread Anthony Ward
Hi, If i have a table with just Userid,Name,Language where userid is primary key. now if i search the first 10 people that speaks english i.e SELECT * FROM tablex WHERE language='English' LIMIT 10; Can't i get the row number of the last matched record? So i can do SELECT...LIMIT nex

Re: Row Number

2003-06-03 Thread Román Sánchez
If i have a table with just Userid,Name,Language where userid is primary key. now if i search the first 10 people that speaks english i.e SELECT * FROM tablex WHERE language='English' LIMIT 10; Can't i get the row number of the last matched record? So i can do SELECT...LIMIT nex

RE: Row Number

2003-06-03 Thread Mike Hillyer
Wouldn't you just type SELECT.LIMIT 10,10 ?? Mike Hillyer www.vbmysql.com -Original Message- From: Anthony Ward [mailto:[EMAIL PROTECTED] Sent: Monday, June 02, 2003 11:21 AM To: [EMAIL PROTECTED] Subject: Row Number Hi, If i have a table with just Userid,Name,Language

Re: Select by row number

2002-11-05 Thread Michael T. Babcock
the row number, if you have one. If you use auto_increment for your primary key, then ORDER BY {primary key} _is_ ordering by insert order. If you want your query to use any other order, you _must_ create a column for that purpose; the database subsystem has no way of knowing (nor should

re: RE: Select by row number

2002-11-04 Thread Egor Egorov
horizonx, Saturday, November 02, 2002, 2:43:07 PM, you wrote: There is no row number in MySQL. You should use ORDER BY to retrieve data in particular order. handf What about the following info in the manual p. 55? handf Add a PRIMARY KEY or UNIQUE key to the table and use this. New in Version

row number for selected set?

2001-05-15 Thread John Cartwright
Hello All, is there any kind of row number pseudo-column that identifies a particular row's position in the query's result set? Something like RowNum in oracle. Thanks! -- john -- === John Cartwright Professional

Current row number

2001-05-02 Thread Living Dead
How can you get the current row number in a query? Example: ROW_NUMBER (not ID) DATA - 1 AAA 2 BBB