Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select statement-making two columns out of one

Status
Not open for further replies.

Bufsabres

Technical User
Nov 27, 2003
20
0
0
CA
I am trying to fill in two rows in a report with information gathered from one. Production Quantity and Scrap Quantity from one column "production". In the Where clause I specify criteria from another column "WH" as follows 'PQ' OR 'PW' OR 'SP' OR 'S1'...'S7'. How can I make only the 'PQ' AND 'PW' quantities go to the Production Quantity-"ProdQty" columm and the 'SP' AND 'S1' TO 'S7' go to Scrap Quantity-"ScrpQty" column in the select statement? I already have a 'CASE' Function in the SELECT clause to change the quantities to a negitive based on a "Credit" column.

Thanks

 
i think you had better posted this in the sql-server forum but something like this springs to mind

Code:
select a.ProdQty from (select field as ProdQty from table as a where WH = 'PQ' or WH = 'PW') as a

Christiaan Baes
Belgium

What a wonderfull world - Louis armstrong
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top