May 17, 2016 at 3:13 pm
In t-sql 2008 for an SSRS report, I am inserting rows into a temp table. In the sql, I am listing fields that will always exist and I am doing a left join on tables and columns that may not exist. In the ssrs report, I only want to display data on the report when data is selected for the tables that have a left join on them. If there is no data in any of the left join columns, I do not want to display data on the report.
Thus right now, if no data exists in the left join columns that are loaded to the temp table, I am deleting the rows from the temp table. This way the data will not appear on the ssrs report.
Can you tell me if this is a good solution? If not, would you show me an example of sql that I could use that would be a better solution?
Here is an example of the existing sql:
declare @student int = 932709
select studentname, studentnumber
from student where @student = studentnumber
left outer join (select studentnumber, address
from stuentabc) as stuentabc
on student.studentnumber = stuentabc.studentnumber
May 17, 2016 at 8:56 pm
If there is no data in any of the left join columns, I do not want to display data on the report.
Then why not use an inner join?
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply