Select IF...

So today's brain teaser, how to best select either column A or column B in MySQL. Here's the setup. We have three columns that count. They are:

  • Name
  • Grade
  • Alt. Grade

In most rows there is a grade and no alt. grade. But every once in a while there are both a grade and an alt. grade. If it were an either-or case it would be simple. But it's an either-and. The question of the day is how to best accomplish it in MySQL 5.

Category: