Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> how to combine columns?
I've got a table of football games with columns for the dates and scores. Something like this:
date ourscore theirscore
2001-02-01 23 49 2001-02-03 19 14 2001-02-08 34 7 2001-02-20 9 3 2001-02-28 12 12
I need a SELECT statement that will show me if we won, lost or tied the game. Something like me this:
2001-02-01 L 2001-02-03 W 2001-02-08 W 2001-02-20 W 2001-02-28 T
I think I'm close. I've tried stuff like:
SELECT date,
ourscore>theirscore,
ourscore<theirscore,
ourscore=theirscore
from games
But as you can see, that only gives me three columns, each with 1's or 0's. So I think I just need to get a bit more fancy with my comparisons.
I'd also then like to be able to show our W-L-T record, which in the above example would be 3-1-1.
I'm just getting back into DB stuff after about a 5 year absence. I'm looking through my old Oracle7 books and I'm not finding anything. I'm thinking there's probably a name for something like this, and if I only new the name, it would make my searches much more productive.
Would appreciate any assistance.
-- Scott Crevier http://www.crevier.org/Received on Tue Jul 17 2001 - 10:14:49 CDT
![]() |
![]() |