-1

In mysql database, I have a column named runs of varchar type in one table. Different rows consists of "FOUR","SIX","BYES",etc in runs column. Now I want to sum this runs column. so these ("FOUR","SIX",etc except "BYES") should convert into (4,6) of int data type.

Is there any function to make assume these string as integers and sum them to give a total. Please anyone help me?

Taryn
  • 242,637
  • 56
  • 362
  • 405
smnth90
  • 750
  • 5
  • 14

1 Answers1

4

No, there is no function. You can create a "lookup" table that has the "word" version of the integer, and its integer value.

word   value
------------
one    1
two    2
three  3
four   4
five   5
...
Kermit
  • 33,827
  • 13
  • 85
  • 121