Reputation: 3
I've been searching for a possible answer to my problem but was unable to find one. Lets assume that I have 2 datasets. dsMediaServerData has two columns: id and channel. I have other dataset (dsCatalogData) with a lot of columns including id and channel. I want to filter dsCatalogData to show only those records that are not in dsMediaServerData.
Upvotes: 0
Views: 880
Reputation: 847
My recommendation would be to update the SQL queries used to populate the datasets so that duplicate id/channels are excluded.
If you can't do this directly through SQL because the data sets are coming from different DB's, you can accomplish this with the use of a parameter.
1) Let's start with the first dataset (dsMediaServerData in your example). Since your example shows filtering by 2 columns, but the data will be travelling through a single parameter, you will need to create a new column that combines both pieces of data.
SELECT Convert(VARCHAR(255), id) + '_' + Convert(VARCHAR(255), channel) as 'combined_columns_to_filter'
2) Now create a new parameter (let's call it @filter).
3) Now update the second dataset. Add the @filter parameter to the WHERE clause.
WHERE Convert(VARCHAR(255), id) + '_' + Convert(VARCHAR(255), channel) NOT IN (@filter)
This should effectively filter the second dataset by removing all records found in the first data set even though the data sets are in separate databases.
Upvotes: 1