Skip navigation
All People > TMACUL > Tiago MACUL's Blog > 2015 > December > 23


select contact_uuid

from mdb..ca_contact as cnt

where not exists (

                                select 0

                                from mdb..usp_contact as usp

                                where cnt.contact_uuid = usp.contact_uuid


How to know if i do the right thing?


Just counting the differences



select count(0) from  mdb..ca_contact




select count(0) from mdb..usp_contact



Comparing the quantity of register on Query A need to be B-C  or ....



select count(0) -(select count(0) from mdb..usp_contact )

from  mdb..ca_contact






Subconsultas com NOT EXISTS

select cnt.last_name, dateadd(ss, s.login_time, '19700101')login, dateadd(ss, s.logout_time, '19700101') logout

from session_log as s

inner join  ca_contact as cnt on = cnt.contact_uuid

where s.logout_time is  null

order by login_time desc