SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Performing an In statement between two datasets


Performing an In statement between two datasets

Author
Message
rs80
rs80
Mr or Mrs. 500
Mr or Mrs. 500 (518 reputation)Mr or Mrs. 500 (518 reputation)Mr or Mrs. 500 (518 reputation)Mr or Mrs. 500 (518 reputation)Mr or Mrs. 500 (518 reputation)Mr or Mrs. 500 (518 reputation)Mr or Mrs. 500 (518 reputation)Mr or Mrs. 500 (518 reputation)

Group: General Forum Members
Points: 518 Visits: 409
I have two oledbsources. One oledbsource has the distinct list of product ids (DataSet A) and another oledbsource has all of the order information with product id (DataSet B). How do I get all those orders (DataSet B) that have product ids in DataSet A?
For example:

Dataset A
product id
1
2


Dataset B
order id product id
1 1
2 1
3 1


the result set should be
order id product id (DataSet A)
1 1
2 1
3 1

The Merge join transformation didn't give the desired results.
J Livingston SQL
J Livingston SQL
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12385 Visits: 37637
rs80 (4/16/2013)
I have two oledbsources. One oledbsource has the distinct list of product ids (DataSet A) and another oledbsource has all of the order information with product id (DataSet B). How do I get all those orders (DataSet B) that have product ids in DataSet A?
For example:

Dataset A
order id product id
1 1
2 1
3 1


Dataset B
product id
1
2

the result set should be
order id product id (DataSet B)
1 1
2 1
3 1

The Merge join transformation didn't give the desired results.



join the two tables on productId?

ps...are you sure your explanation of which data set is which is correct?

________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day

rs80
rs80
Mr or Mrs. 500
Mr or Mrs. 500 (518 reputation)Mr or Mrs. 500 (518 reputation)Mr or Mrs. 500 (518 reputation)Mr or Mrs. 500 (518 reputation)Mr or Mrs. 500 (518 reputation)Mr or Mrs. 500 (518 reputation)Mr or Mrs. 500 (518 reputation)Mr or Mrs. 500 (518 reputation)

Group: General Forum Members
Points: 518 Visits: 409
You were right. The datasets were referred incorrectly.

In the merge join transformation, when I do an inner join I only get 1 record back. However, when I do a t-sql query I get all 3 records back.
J Livingston SQL
J Livingston SQL
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12385 Visits: 37637
rs80 (4/16/2013)
You were right. The datasets were referred incorrectly.

In the merge join transformation, when I do an inner join I only get 1 record back. However, when I do a t-sql query I get all 3 records back.


care to share your code?

________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search