General Sql Question

liunx

Guest
Hey guys...I've got a question for ya.<br /><br />I'm trying to create a suppression process so I can then create a list of people i want to email. So far I have 2 tables. Table A contains email addresses and another field I call <i>suppression_type</i> (this field will get it's value based on different types of suppression that i do). Table B contains a running lists of people that opt not to receive an email. Anyways, basically I'm running a query that matches on email addresses and then updates the suppression_type field in table A.<br /><br />I am currently doing this using a sub query that looks like this:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->update TableA<br />set suppression_type = 1<br />where rtrim(ltrim(Email) in (select ltrim(rtrim(Email)) from TableB)<br />and suppression_type is null<!--c2--></div><!--ec2--><br /><br />I tried running counts using this sub query and then using another query that has an inner join (should do the same thing right?). I noticed that the counts were higher using an inner join. Here's the query I ran:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->select count(*)<br />from TableA as A<br />inner join    <br />    TableB as B on<br />    A.Email = B.Email<br />Where A.suppression_type is null<!--c2--></div><!--ec2--><br /><br />Can anyone explain the difference between these two and why they would be off? <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/shocking.gif" style="vertical-align:middle" emoid=":shocking:" border="0" alt="shocking.gif" /> <br /><br />Thanks so much for your help!<br /><br />-Sam<!--content-->
 
Top