Monday, March 19, 2012

MS Sql Query problem mit not exists , help

Hello,

i hope that somebody can help me. I have a problem with ms sql query.

i have two tabels(wtmenSends and T1) in a database. i need pick up all email addresses from table wtmenSends but without those email addresses which are in table T1.

I have written this sql query to get these Emails, but i get nothing by this query. Can somebody tell me, where is the problem? Thanks.

select wtmenSends.Email

from

wtmenSends

where

notexists(

select

T1.*

from

(

SELECT

wtmenSends.Id, wtmenSends.Email, wtmenSends.IDMailing, wtmenSends.Title, wtmenSends.Firstname, wtmenSends.Lastname, wtmenSends.IDUser,

wtmenSends

.IdStatus, wtmenSends.IsSent, wtmenSends.DateSent, wtmenSends.wtobjIDClass, wtmenSends.wtobjDateCreated,

wtmenSends

.wtobjDateChanged, wtmenSends.wtobjUserCreated, wtmenSends.wtobjUserChanged

FROM

wtmenRobinsonsINNERJOIN

wtmenSends

ON wtmenSends.EmailNOTLIKE'%'+ wtmenRobinsons.FilterAND wtmenRobinsons.IsDomain= 1)as T1innerjoin

wtmenRobinsons

on wtmenRobinsons.Filter= T1.Email)

Hello my friend,

To start with, use the following SQL, and then add your extra clauses to it that you wish: -

SELECT Email FROM wtmenSends WHERE Email NOT IN

(SELECT Email FROM T1)

Kind regards

Scotty

|||

Hi Scotty,

thank you. my problem has been resolved.

best regards

pinsha

No comments:

Post a Comment