View Full Version : Query help!


Techsavy
05-13-2008, 07:51 PM
Hi,

I have a table with five columns Date, Outfall1flow,Outfall2flow, Outfall3flow, outfall4flow

now I would like to have just three columns Date, OutfallFlow and OutfallID.

I would like to have flow only in one column identified by its id like 1,2,3,4..


How can I do this?

Thanks,

pbaldy
05-13-2008, 09:42 PM
If I understand correctly

SELECT Date, Outfall1flow, 1 AS OutfallID
FROM TableName
UNION ALL
SELECT Date, Outfall2flow, 2 AS OutfallID
FROM TableName
UNION ALL
...

By the way, Date is a reserved word and not a good choice as a field name.