Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 20764

Case when, how to go beyond the first then

$
0
0

Hello,

Sorry for the not too great headline, didnt know how to describe it.

I have given what I have written so far below to help.

Using the case when, I have given myself a component_code, for that I need a b.physical_qty as well. However I can only get it for the product_code.

What I need I guess is a way to direct what column something needs to look at rather than just deafulting to key column.

Sorry if it is not very clear. Thanks

Daniel

select
	sum (b.physical_qty) as phys, a.product_code, b.long_description, ' ' as Prediction, ' ' as Line, sum (b.physical_qty - b.allocated_qty) as Free
	,Case when [sequence_number] = '0020' then [component_code]
		else null
	end [eb]
from scheme.bmassdm a
inner join scheme.stockm b 
on a.product_code = b.product
where a.product_code >= 'A' AND a.product_code <=  'D'
and a.assembly_warehouse = 'L1'
and a.sequence_number = '0020'
and b.abc_category = 'A'
group by a.product_code, a.component_code, a.sequence_number, b.long_description
order by a.product_code


Viewing all articles
Browse latest Browse all 20764

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>