how to add an autoincrement field in a select

This is a discussion on how to add an autoincrement field in a select within the MySQL Database forums, part of the Database Forums category; Hello from Italy! I have a table students with fields name and age I need to do a select query ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-12-2008
nintesa
 
Posts: n/a
Default how to add an autoincrement field in a select

Hello from Italy!


I have a table students with fields name and age

I need to do a select query like:

select name
from students

where I would like to add a field that is auto-increment, so the query
result must be:

id, name
1 mario
2 gino
3 saverio
4 ...

But I don't now how I can put a auto-increment field in a select
statement...

Can anyone help me?

Thanks!
Reply With Quote
  #2 (permalink)  
Old 04-12-2008
Paul Lautman
 
Posts: n/a
Default Re: how to add an autoincrement field in a select

nintesa wrote:
> Hello from Italy!
>
>
> I have a table students with fields name and age
>
> I need to do a select query like:
>
> select name
> from students
>
> where I would like to add a field that is auto-increment, so the query
> result must be:
>
> id, name
> 1 mario
> 2 gino
> 3 saverio
> 4 ...
>
> But I don't now how I can put a auto-increment field in a select
> statement...
>
> Can anyone help me?
>
> Thanks!

http://forums.mysql.com/read.php?10,36490,36511



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:18 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0