With the join syntax used below is "k" a temporary table? What is 'k' and 'd'and how and where is it stored?
Code example:
select x.name, x.addressl1, x.city
into #temptable
from server.SQLServer.database.tablename x
join (
select name, addressl1, city, count(*) as instances
from (select distinct name, addressl1, city, code
from server.SQLServer.database.tablename) as d
group by name, addressl1, city
having count(*) > 1
) k on x.name = k.name, x.addressl1 = k.addressl1, x.city = k.city
join ( etc...
Code example:
select x.name, x.addressl1, x.city
into #temptable
from server.SQLServer.database.tablename x
join (
select name, addressl1, city, count(*) as instances
from (select distinct name, addressl1, city, code
from server.SQLServer.database.tablename) as d
group by name, addressl1, city
having count(*) > 1
) k on x.name = k.name, x.addressl1 = k.addressl1, x.city = k.city
join ( etc...