|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Hi, I need to write an MS SQL statement to select all customer profiles from the customer table that don’t have a row belonging to them in the CallLog table.
Could anyone help me please? Thank you. Here is an example of what I’m trying to do: SELECT Profile.CustID, Profile.CustType FROM Profile WHERE CustID NOT EXISTS (SELECT CallLog.CustID FROM CallLog) |
|
#2
|
||||
|
||||
|
there are three ways to do this:
Code:
select CustID
, CustType
from Profile
where CustID not in
( select CustID
from CallLog )
Code:
select CustID
, CustType
from Profile
where not exists
( select 1
from CallLog
where CustID = Profile.CustID )
Code:
select Profile.CustID
, Profile.CustType
from Profile
left outer
join CallLog
on Profile.CustID = CallLog.CustID
where CallLog.CustID is null
|
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Nested Sub-query + Exists in MS SQL ???? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|