sql server - SQL Group by doesn't show all variables -
I am getting a list from the MSSQL database, I have a system list and content in a database table. I want to get the summaries. But the database is giving me only rows which are not zero. Here is my code
system_no AS 'system name', SUM (case when (mat_2 = 'AS') then 'AS' as '2', SUM (case when (Mat_2 = '' SS ') then in the form of' SS ', SM (case when (mat_2 =' CS ') then' CS 'as' CS 'as' creation 'where' 2014-02- Between 03 'and' 2014-02-09 'group' system 'by' welding_det 'unit,' system name ', SUM (in case when (mat_2 =' AS ') then' AS ', SUM (case when (Mat_2 = 'ss') again mat_2_size In the form of 'SS', SM (case when (mat_2 = 'CS') then mat_2_size end) as 'CS' from fabrication_table where between '2014-02-03' and '2014-02-09' The result of this query is below System Name SS CS Assistant Steam Faucet Faucet 6.75 Chemical Dosing Nouvel 10.00 Tap Off Cooling Water Faucet 1.50 193.75 Condenset Nail Nail 32.00 Diminished Water Nail 34.00 Faucet Feedwater Nail Faucet 6.00 Gases (N2, H2, CO2) Zero Null 385.25 GT Air InkTec Anti-icing Shoe Somewhere taps 220.50 Main Steam & amp; By-pass 49.50 Noull 84.00 Seawater intake faucet 27.50 faucets ST drains 37.50 tap 175.50 ST seals steam faucet 2.25 175.00 Total 87.00 75.25 1278.75 But my system name list is:
potable water service water seawater intake chemical dosing stop cooling water GT interconnection feedwater hrssyver flyer sampling fire fighting GT Lube oil oxygenic vapor extinct water Dedicated water ST lube & amp; Seal Oil Main Steam & amp; Near Scheduled Tribe drain GT Air intake anti spinning condenser Vacuum ST jaws steam condensed plant drainage punched water compressed air GT drainage fuel gas gases (N 2, H2, CO2) Here my question I want to: List all the variables ie query is not a list of fire fighting, but I want to list fire fight like this
Fire Fighting Nail nail nail < P> Try to avoid using "lapsing" values by using the lace:
, SUM (case AS (as 'AS') Change:
, SUM (case when (mat_2 = 'AS')) organized as 'AS' (mat_2_isize, 0) END)
Comments
Post a Comment