I have a view in SQL Server 2008 that I want to use for a report in SSRS 2008.
The main problem is that I have to use two different datasets in one table and cannot do grouping as I want it. Both datasets come from this view. Let’s say in one column of my report table I want to sum all computers of all school buildings of my country. In the other column, the ratio students of schools per computer.
Now, in DB there are two different tables one for Buildings and one for Schools (because sometimes there are different buildings for one school or other similar scenarios). Joining them results in more couples building-school than needed for the computer-sum column, it will result summing different times the same building (if more than one schools operate in that building).
The table is this:

To avoid this I have done those two datasets, one from the building point of view, and one from the school point of view. But these are two datasets in one table! To solve my problem, I have thought to add a special column to my view : it checks automatically if a BUILDING_ID is shown twice or more in the result table, f.e. like this:

The problem is that I don’t know if this is possible and if it is, I don’t know how to do it.
Maybe this can give you a hint:
If you just want 1’s or 0’s