Unix Technical Forum

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 forums, part of the Database Server Software category; --> Hello from Italy! I have a table students with fields name and age I need to do a select ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-15-2008, 08:32 PM
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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-15-2008, 08:32 PM
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



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:05 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com