Hello, thanks for your time.<BR><BR>I&#039m just wondering how I can use an if/then to mail to an email address, based on a value of the id. I need to explain first, I guess:<BR><BR>Table 1<BR>ID Name Email<BR>1 joel joel@blah.com<BR><BR>Table 2<BR>SignupID affiliate<BR>1 (= to table 1 id, always) email of Aff#1<BR>1 email of aff#2<BR>1 email of aff#3<BR>1 ""#4<BR>1 "" #5<BR><BR>See how "Joel" with id1 has 5 affiliates? I want to select both tables where ID=SignerID and (icount)=&#062;5<BR><BR>What is ICOUNT? THAT is my dilema...<BR><BR>I&#039d like a var (The hard part for me) to = the # of referrals per id. (I.e the icount for ID1=5) If there are 4 id&#039s such as<BR><BR>ID<BR>1<BR>1<BR>1<BR>1 then the icount for 1=4. That&#039s what I am looking for...<BR><BR>The goal?<BR><BR>When &#039joel&#039 submits the 7th affiliate into table 2, I want the sql to say "Select From both tables where ID=SignupID and idcount=&#062;7<BR><BR>IF IDcount=&#062;7<BR>(Cdonts) <BR><BR>The &#039to&#039 I would pull from db, I guess.<BR><BR>Is that LOGIC correct?<BR><BR>Can that work? Do I put the IF/Then a specific place AMONG that code, such as right after the sql statement?<BR>And can var icount exist? How do I get such a value by itself? THAT is the toughy. <BR><BR>Thanks. I had to ask...I just don&#039t know if the logic is right before I tackle this. It would be great to have.