sql server - Filtering Query with NOT EXISTS -


i attempting query database using sql server in visual studio. database in question contains payment information, identifying transactions , resulting software licenses via orderid , license id. ocassionally, these licenses revoked due misuse.

right now, i'm attempting run query returns customers based upon this:

select     [order].lastname,    [order].firstname,    [order].companyorganization,    [order].emailaddress,    [order].country,    [license].licenseid,    [license].instancecount  [order], [license]      [license].orderid = [order].orderid     , [order].status = 1     , not exists (select licenseid [licenserevocation])  order [license].instancecount desc; 

the query returns no results, , know it's because of "not exists" portion. however, i'm not sure why. can clear how "exists" works , how implement query?

you need define condition on check values if there exist or not,

also use on clause syntax joins.

select [order].lastname      , [order].firstname      , [order].companyorganization      , [order].emailaddress      , [order].country      , [license].licenseid      , [license].instancecount  [order]  inner join [license] on [license].orderid = [order].orderid   [order].[status] = 1  , not exists (select 1                  [licenserevocation]                 licenseid = [license].licenseid)  --<-- missing condition order [license].instancecount desc; 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -