many thanks :)
that was exactly what I needed
g
On Nov 26, 2004, at 4:27 PM, Rhino wrote:
----- Original Message -----
From: "Graham Anderson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 26, 2004 6:28 PM
Subject: change field names in a query
what is the proper mysql syntax to change field names after the query
is done
if I have a table with:
id
englishText
spanishText
picture
And I query the table with:
select id, spanishText
from myTable
limit 30
how do I change the 'spanishText' field name to say 'language' ?
many thanks
g
If I understand your question correctly, you need to use an 'as'
expression.
For example:
select id, spanishText as 'language'
from myTable
limit 30;
This example tells MySQL to display the contents of the columns named
'id'
and 'spanishText'. The column headings in the result set will be 'id'
for
the 'id' column (if you don't supply an 'as' expression, the original
column
name is used most of the time) and 'language' for the 'spanishText'
column
since that is the column heading you preferred.
There are some limitations on the aliases that you supply via the 'as'
expression but you'd have to look them up in the MySQL manual to be
sure
what they are; if the MySQL rules are like rules for DB2, there is a
length
limit for aliases and aliases that contain embedded blanks need to be
in
quotes.
Rhino
graham anderson
310.402.3980
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]