Robert,

Being able to reference the column by position violates relational 
theory and I doubt any DBMS would support it. However you could do 
something quick and nasty if you use a "shellish" environment to access 
your db (such as sqsh for sybase-like dbs).

Ines

Robert Citek wrote:
> Is it possible to select fields in a table by position?
> 
> Let's say I have a table "foobar" like so:
> 
> foo   bar   bat
> a     1     x
> b     2     y
> c     3     z
> 
> I can select the bar field with SQL like so:
> 
>    select bar from foobar;
> 
> Since bar is the second field in the table, I was wondering if I can  
> select fields using the numerical position:
> 
>    select 2 from foobar;
> 
> Unfortunately, that simply returns the value of "2" for every  
> record.  A search through my Oracle, PostgreSQL, and MySQL books did  
> not mention that this can be done, but maybe it can and I'm just  
> overlooking something.
> 
> Regards,
> - Robert
> http://www.cwelug.org/downloads
> Help others get OpenSource software.  Distribute FLOSS
> for Windows, Linux, *BSD, and MacOS X with BitTorrent
> 
> 
>  
> _______________________________________________
> CWE-LUG mailing list
> [email protected]
> http://www.cwelug.org/
> http://www.cwelug.org/archives/
> http://www.cwelug.org/mailinglist/

-- 
Ines Sombra
Senior Web Developer
John M. Olin School of Business
Washington University
314.935.7986
[EMAIL PROTECTED]


 
_______________________________________________
CWE-LUG mailing list
[email protected]
http://www.cwelug.org/
http://www.cwelug.org/archives/
http://www.cwelug.org/mailinglist/

Reply via email to