Skip to main content
Formatting code
Source Link
jarlh
  • 44.9k
  • 8
  • 52
  • 68

imI'm using a SQL query for an app, but I cant get it to count values with 0 results. 

The code is shown below:

select CarrierPosition, COUNT( * ) as FailCount   from tbl_0000000024,   tbl_0000000025 where asictestdate>=asictestdate >= DATEADD(hour,-6, getdate())  and FK_AS0000000032=fk_as0000000056FK_AS0000000032 = fk_as0000000056  and fk_as0000000046='135'fk_as0000000046 = '135'  and FailReason = '151'  and tbl_0000000025.Status = ' Current' group by CarrierPosition Order by CarrierPosition 

It should show up a fail count for 8 positions, but leaves out positions 1 and 4 as they have a FailCount of 0. How do I get it to show the other 2 rows?

Thanks

im using a SQL query for an app but I cant get it to count values with 0 results. The code is shown below:

select CarrierPosition,COUNT( * )as FailCount from tbl_0000000024, tbl_0000000025 where asictestdate>= DATEADD(hour,-6, getdate()) and FK_AS0000000032=fk_as0000000056 and fk_as0000000046='135' and FailReason = '151' and tbl_0000000025.Status = ' Current' group by CarrierPosition Order by CarrierPosition 

It should show up a fail count for 8 positions, but leaves out positions 1 and 4 as they have a FailCount of 0. How do I get it to show the other 2 rows?

Thanks

I'm using a SQL query for an app, but I cant get it to count values with 0 results. 

The code is shown below:

select CarrierPosition, COUNT(*) as FailCount  from tbl_0000000024,   tbl_0000000025 where asictestdate >= DATEADD(hour,-6, getdate())  and FK_AS0000000032 = fk_as0000000056  and fk_as0000000046 = '135'  and FailReason = '151'  and tbl_0000000025.Status = ' Current' group by CarrierPosition Order by CarrierPosition 

It should show up a fail count for 8 positions, but leaves out positions 1 and 4 as they have a FailCount of 0. How do I get it to show the other 2 rows?

Thanks

Source Link

SQL count records with 0 Value

im using a SQL query for an app but I cant get it to count values with 0 results. The code is shown below:

select CarrierPosition,COUNT( * )as FailCount from tbl_0000000024, tbl_0000000025 where asictestdate>= DATEADD(hour,-6, getdate()) and FK_AS0000000032=fk_as0000000056 and fk_as0000000046='135' and FailReason = '151' and tbl_0000000025.Status = ' Current' group by CarrierPosition Order by CarrierPosition 

It should show up a fail count for 8 positions, but leaves out positions 1 and 4 as they have a FailCount of 0. How do I get it to show the other 2 rows?

Thanks