I'm trying to prepare a report like on image below
When I'm trying to preview a report I get three additional columns between column Reservations and first type of stock_description
Now in T-SQL Query in select part I have got:
sum(units)
sum(units_required),
sum(units_avaliable)
I know that t-sql ignore null values. But when I change the query to:
sum(isnull (units,0)),
sum(isnull (units_required,0)),
sum(isnull (units_avaliable,0))
then I get 0 value in those additional columns instead of null value. When query returns any value them it is where it should be - in one of the stock_description.
What should I do to delete those three columns between Reservations and stock_location?
答案 0 :(得分:0)
It is because your data has NULL values of Stock_description
field. You can put additional condition in your TSQL to exclude NULL Stock Description.
SELECT ....
FROM ....
JOIN ....
WHERE .....
AND TableName.Stock_Description IS NOT NULL
But one thing you need to watch/Test is what happens if there are units under NULL
Stock_description
You can also handle this in SSRS by filtering either at Tablix or datasource but doing in SQL itself is much better.