Re: Table Query



Ryan,

One easy way is:

SELECT 'FEDERAL', Federal
FROM MyTable
UNION ALL
SELECT 'FICA1', FICA1
FROM MyTable
UNION ALL
SELECT 'FICA2', FICA2
FROM MyTable

If you are on SQL Server 2005, you might also look at the UNPIVOT operator.

RLF

"Ryan Mcbee" <RyanMcbee@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:29D6BB62-73A1-4E7D-9144-27A8278EDEB4@xxxxxxxxxxxxxxxx
I have a table that has the following three fields and values that I am
trying to build a query on;

Column name-FEDERAL, FICA1, FICA2
Values- 1 , 100 , 200
2 , 300 , 400

How can I get a query to look like this?;
Column- TaxCode, Value
Values- FEDERAL , 1
FEDERAL, 2
FICA1, 100
FICA1, 300
FICA2, 200
FICA2, 400

I am doing this because I am trying to build a payroll report. The other
table that I am working with is structered like this.

Thanks,
Ryan



.