CAST in multiple columns to average

Asked

Viewed 45 times

0

I have several columns in a csv table, I imported the table into mysql, but when I import into mysql I have to do this import as varchar for all data. If I do a CAST in these columns and then take out the average I think will work out the average value, however, I do not know how to do. Can someone help us? Thank you.

  • Have you tried to average without doing CAST?

  • I took yes, even worked, because I checked together with Excel, however, there is a person who is quite experienced in mysql and said I would have to cast.

  • Would not be AVG(CAST(campo as SIGNED))?

  • SELECT name, CAST(AVG(cota_fpm) AS decimal(3,2)) AS cota_fpm FROM dadosv5 GROUP BY name; - Would that be so? Only I have several columns, I have to make for each one is not?

  • Craa, I’m kind of amateur in Mysql, I only know the basics. I don’t know a way to do everything at the same time.

  • All right, I thank you for your help buddy. Let’s wait and see if any of the beasts answer.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.