Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> how to combine columns?

how to combine columns?

From: Scott Crevier <scott_at_crevier.org>
Date: Tue, 17 Jul 2001 15:14:49 GMT
Message-ID: <3b54536c.31543127@news-server.new.rr.com>

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US