You could use the CAST function, although I have just discovered that MySQL
is rather limited in the types you are able to CAST to...

http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html

-----Original Message-----
From: Eric Lommatsch [mailto:[EMAIL PROTECTED]
Sent: 21 August 2007 22:52
To: mysql@lists.mysql.com
Subject: Why is the average of an int column returned as a string


Hello,
 
I am working with a query that calculates the averages of survey answers. 
 
The survey answers are stored in the database as int(11) fields. When I run
the query the results that I am getting are being returned as string data. 
 
The query that I am working with is a data source for a Crystal Reports
reports. The average columns that are being returned by the query are used
in
the report in fields that have been formatted for double values.
 
I am using MySQL 5.0.18 as the database. What would I have to do to get the
averages of Int columns to return as doubles, rather then having to change
all of my columns to be double columns?
 
Thank you
 
Eric H. Lommatsch
Programmer
360 Business 
2087 South Grant Street
Denver, CO 80210
Tel 303-777-8939
Fax 303-778-0378
 
[EMAIL PROTECTED]
 

This email is confidential and may also be privileged. If you are not the 
intended recipient please notify us immediately by telephoning +44 (0)20 7452 
5300 or email [EMAIL PROTECTED] You should not copy it or use it for any 
purpose nor disclose its contents to any other person. Touch Local cannot 
accept liability for statements made which are clearly the sender's own and are 
not made on behalf of the firm.

Touch Local Limited
Registered Number: 2885607
VAT Number: GB896112114
Cardinal Tower, 12 Farringdon Road, London EC1M 3NN
+44 (0)20 7452 5300


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to