Re: Retrieving a numeric series from a SELECT

2002-02-13 Thread José Angel Blanco Linares

Hi, Fellows!

Sorry for my poor english. Thats why I can explain myself properly.
:- )

What I really want is a calculate column with consecutive numbers from n to 
m, where n can be any number, and m depending on the result of the WHERE 
clause. I need to print pay orders for students, this pay orders use a 
consecutive control number, the criteria to select students use to be variable.
Example:
SELECT colnum, id, name FROM students WHERE status='OK'
(4 rows selected)
or
SELECT colnum, id, name FROM students WHERE grade=1
(230 rows selected)


colnum must be the same number that is printed in the pay order. The next pay 
order on the printer is 15000, then colnum of the first row of the SELECT 
must be 15100, the next row 15001, and so on. 

you get it?

I remember that the sample i saw in this SQL list only used a SELECT statement 
without a table, or whitout a memory variable. it was only a SELECT 
something, and it returns a consecutive serie from 1 to 100.

Thanks again.
__
José Angel Blanco Linares
Depto Servicios de Apoyo Académico
Centro de Enseñanza Técnica Industrial
3641-3250, ext: 266

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Retrieving a numeric series from a SELECT

2002-02-12 Thread José Angel Blanco Linares

Hi, everybody

How can I get a numeric column from a SQL SELECT statement?
I mean, with a SELECT get something like this

ColNum   or   ColNum
  1 10
  2 11
  3 12
  4 13
  5 14
  6 15
  ...   ...

Some time ago, somebody wrote a sample that do exactly what I need. In fact, I 
took that sample and saved it to my HD, but i can't find it, hehehe.

TIA

__
José Angel Blanco Linares
Depto Servicios de Apoyo Académico
Centro de Enseñanza Técnica Industrial
3641-3250, ext: 266

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Retrieving a numeric series from a SELECT

2002-02-12 Thread Anvar Hussain K.M.

Hi,

If you have a table with at least the number of rows that you want in your 
series
you can do this.

Set @Colnum := 0;
Select @Colnum := @colnum+1 as colnum from tablename limit (number of rows 
required);
set @column := 0;

If you want a series starting from a value other than 1, initialize colnum 
value to one less than
required starting value.

Anvar.

At 03:08 PM 08/02/2002 -0600, you wrote:
Hi, everybody

How can I get a numeric column from a SQL SELECT statement?
I mean, with a SELECT get something like this

ColNum   or   ColNum
   1 10
   2 11
   3 12
   4 13
   5 14
   6 15
   ...   ...

Some time ago, somebody wrote a sample that do exactly what I need. In fact, I
took that sample and saved it to my HD, but i can't find it, hehehe.

TIA



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Retrieving a numeric series from a SELECT

2002-02-08 Thread José Angel Blanco Linares

Hi, everybody

How can I get a numeric column from a SQL SELECT statement?
I mean, with a SELECT get something like this

ColNum   or   ColNum
  1 10
  2 11
  3 12
  4 13
  5 14
  6 15
  ...   ...

Some time ago, somebody wrote a sample that do exactly what I need. In fact, I 
took that sample and saved it to my HD, but i can't find it, hehehe.

TIA

__
José Angel Blanco Linares
Depto Servicios de Apoyo Académico
Centro de Enseñanza Técnica Industrial
3641-3250, ext: 266

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Retrieving a numeric series from a SELECT

2002-02-08 Thread Paul DuBois

At 15:08 -0600 2/8/02, José Angel Blanco Linares wrote:
Hi, everybody

How can I get a numeric column from a SQL SELECT statement?
I mean, with a SELECT get something like this

ColNum   or   ColNum
   1 10
   2 11
   3 12
   4 13
   5 14
   6 15
   ...   ...

Some time ago, somebody wrote a sample that do exactly what I need. In fact, I
took that sample and saved it to my HD, but i can't find it, hehehe.

Do you mean you want to number the output rows from a query?

Do you mean you want to specify a beginning and ending number and
generate a series containing all the numbers from the beginning to the
end?

Or something else?


TIA

__
José Angel Blanco Linares
Depto Servicios de Apoyo Académico
Centro de Enseñanza Técnica Industrial
3641-3250, ext: 266

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Retrieving a numeric series from a SELECT

2002-02-08 Thread Anvar Hussain K.M.

Hi,

If you have a table with at least the number of rows that you want in your 
series
you can do this.

Set @Colnum := 0;
Select @Colnum := @colnum+1 as colnum from tablename limit (number of rows 
required);
set @column := 0;

If you want a series starting from a value other than 1, initialize colnum 
value to one less than
required starting value.

Anvar.

At 03:08 PM 08/02/2002 -0600, you wrote:
Hi, everybody

How can I get a numeric column from a SQL SELECT statement?
I mean, with a SELECT get something like this

ColNum   or   ColNum
   1 10
   2 11
   3 12
   4 13
   5 14
   6 15
   ...   ...

Some time ago, somebody wrote a sample that do exactly what I need. In fact, I
took that sample and saved it to my HD, but i can't find it, hehehe.

TIA



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php