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...
From: Eric Lommatsch [mailto:EricL@stripped]
Sent: 21 August 2007 22:52
Subject: Why is the average of an int column returned as a string
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
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?
Eric H. Lommatsch
2087 South Grant Street
Denver, CO 80210
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
postmaster@stripped. 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