Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
MichaelP
Jedi Yak
2489 Posts |
Posted - 2003-04-23 : 15:16:07
|
Lets say I have two datasets A and B. Both contain a field called e-mail. Dataset B contains a list of addresses that I've already sent an e-mail to. Dataset A contains a list of all possible addresses.I want to filter out all of the addresses in A that exist in B. Any ideas?Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2003-04-23 : 15:38:26
|
SELECT B.emailFROM BigTable BLEFT OUTER JOIN SmallTable S ON S.email = B.EmailWHERE S.email IS NULLHow's that?Sam |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2003-04-23 : 16:05:18
|
I could do it easily in SQL server, but due to some rather involved techincal contrains, I need to be able to do this with a .Net Dataset. That's why I put it in other topics. Thanks for the reply though!Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-04-23 : 16:47:00
|
Without knowing much about .net, here's some pseudo code:1. Open dataset A and go to first row, sorted by email address2. open dataset B and go to first row, sorted by email address3. if (A.email < b.email) or (datasetB.EOF), then - A.email does not exist in B- Move to the next record in dataset A4. if a.email = b.email, then- a.email exists in dataset B- move next on both A and B5. if (b.email < a.email) or (datasetA.EOF), then- something is wrong; an email address exits in dataset B but not in dataset A- move next in dataset B6. Loop back to step 3 until EOF for dataset A and Bsomething like that -- the old fashioned way to compare two lists. I have no idea if this helps at all or even applies to your problem.I sometimes miss the old days before SQL when we used to do fun stuff like this by hand, either by looping through arrays in memory or files on a disk ...*sniff*- Jeff |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2003-04-23 : 16:49:44
|
Yeah I've thought about itterating through a list, but DataSets have a "filter" property. What I might have to do is create a CSV list from dataset B and set my filter to "EmailAddress NOT IN(" & myCSVList & ")"Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
|
|
joldham
Wiseass Yak Posting Master
300 Posts |
Posted - 2003-04-23 : 16:59:47
|
Michael,I haven't tried this, but can you create a relationship between the two datasets, then add add the two datasets to a new view, then filter the view?Jeremy |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2003-04-23 : 17:01:22
|
That's an idea too.I'm working on trying to make a TSQL only solution so that there is no Dataset B. I think I've figured out a way around the "technical" issues.Thanks to everyone for their help!Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
|
|
|
|
|
|
|