I would like to create a function or procedure that I can use in mysql but I'm not sure what the syntax would be. What I want to do is take the value from a column and see if it's a 1 or 2, and based on that, return the value from either column A or B. So for example, my select function would be something like:
select a, b, c, functionA(c) from table;
Below is the pseudo-code of my function
functionA(int x){
if(x==1)
//return value in column A
else
//return value in column B
}
SQLandmysqlfromknownarray in your profile ))