sql server - sql I don't want to lose null values when I'm using group by -


I am trying to figure out which merch has traveled a poi out of its way . To do this I need to find void values ​​from vp.poiid, but when I lose zero value on that column, I create the group.

 . . (As the date, select me.MerchName vp.routedate, mercid as me.id, as done ov.poiid, planned, vp.poiid as the case when ov.poiid re-calculate (Ov.poiid) is notDone the end, the case is when vp.poyid void again counting (vp.poiid) end outOfRoute asb_visitplan joining in full from the vice president on the OutVisitData ov (vp.poiid = ov.poiid and ov. Commitdate = vp.routedate and vp.merchid = ov.merchid) include atb_merchs me on (vp.merchid = me.id) where my.id = 1 group vp.rateet, m. mercked, iiid , Ow. Poiid, vp.poid) A. . .  

When I run this program, I get this view:

  Date Name ID planned Not Out Out 2013-11-06 00: 00: 00.000 Seven Fungus 1 30 30 0 Newell 2013-11-06 00: 00: 00.000 Seven Fungus 1 34 34 Faucet 2013-11-06 00: 00: 00.000 Seven Fungus 1 48 48 Faucet 2013-11-06 00 : 00: 00.000 Seven Kavak 1 54 54 0 Zero 2013-11-06 00: 00: 00.000 Seven Kavak 1 Zero 1235 1235 Zero 2013-11-06 00: 00: 00.000 Seven Kavak 1 Zero 1236 1236 Zero 2013-11-07 00: 00: 00.000 Seven Kavak 1 30 30 0 Zero 2013-11-07 00: 00: 00.000 Seven Kavak 1 49 49 0 Zero  

You get all the results in outOfRoute values ​​in this result (But it is not really) as a matter of fact. Is there a way to see actual results in this table? And I need to group these columns, this is a subquiry and I count the final results in the planned column actually there are zero values ​​but I can not even see them.

PS: I am using SQL Server

I think that I forgot for the first time you know, do not want to count the records who have nulls for those guys?

  ov.poiid ov.poiid is zero) from the COUNT (selection), VP notDone, COUNT (ou select from VP as POIID IS NULL) says its current statement "these records Display the count when the grouped field is zero, "which never appears. 

You will need to redefine the joining of those selections; I went for brevity for the moment.

(I got the answer again, the better answer.)


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -