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
Sushta GuthnarPosted Jan 4, 2012, 1:10 PM
This is those question rupees I am laughing incredibly
Snortling outsides,
Shusta
Prabhu RajaPosted Jan 4, 2012, 6:33 AM
You can Also Use IS NULL or IS NOT NULL To Select Rows from Table.
Jignesh TrivediPosted Jan 4, 2012, 5:20 AM
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..
Pravin GhadgePosted Dec 30, 2011, 5:11 AM
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).
AartiPosted Dec 30, 2011, 12:26 AM
Hi,
Try with below script
isnull(sum(cast( AcidingIssueTestRtn.testPiece as decimal(18,3))),0) as Weight