i selects a sum of value between two dates, I know
in that date there is no value in the table
,But one blank row select in this case
my query is
sum(cast( AcidingIssueTestRtn.testPiece as decimal(18,3))) as Weight
How to avoid?
I not need blank row
Loading

AartiRank #2,383 · 594 reputationPosted Dec 29, 2011, 7:26 PM EST
Hi,
Try with below script
isnull(sum(cast( AcidingIssueTestRtn.testPiece as decimal(18,3))),0) as Weight
Pravin GhadgeRank #1,340 · 1.3K reputationPosted Dec 30, 2011, 12:11 AM EST
But if u don't want 0 or blank row then it can't be possible because.
Sum is Aggregate function. which will give value or null/blank(if no record is there).
Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 4, 2012, 12:20 AM EST
As per my knowledge,
sum is aggregate functions in sql and aggregate functions always return as value either null or any value.
so cannot remove that row but
try following solution.
select * from ( select isnull(sum(cast( AcidingIssueTestRtn.testPiece as decimal(18,3))),0) as Weight
from table
)A
where A.Weight is not null
hope this help..
Prabhu RajaRank #861 · 2.6K reputationPosted Jan 4, 2012, 1:33 AM EST
You can Also Use IS NULL or IS NOT NULL To Select Rows from Table.
Sushta Guthnar110 reputationPosted Jan 4, 2012, 8:10 AM EST
This is those question rupees I am laughing incredibly
Snortling outsides,
Shusta