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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two Fields in One

Status
Not open for further replies.

codrutza

Technical User
Mar 31, 2002
357
IE
Please help me with this. I have to do a report. I have to select in the same column
the container number CN: for FJ.crg=’F’ from FC.Number and for FJ.crg=’L’ FM.Number.

I have to do the same for the container type.

How/Can I write an if/case in a select statement?

I mention that in select I have other field as well

Select
FJ.crg
FJ.Weight,

?
If
?
From
..
Where

 
Could you post some example data and desired result from it?

Borislav Borissov
VFP9 SP2, SQL Server
 
Maybe something like

Code:
SELECT SUM(CASE WHEN FJ.crg=’F’ THEN 1 ELSE 0 END) AS Fval,
       SUM(CASE WHEN FJ.crg=’L’ THEN 1 ELSE 0 END) AS Lval...

djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top