WebTechKitchen; Your Web Technology Kitchen, contact us to create, or maintain your websites and other digital properties.

insert into temporary table in sql server

Submitted by barnettech on Thu, 08/09/2018 - 18:33


DECLARE @result1 TABLE(subtype VARCHAR(5), total INT)

INSERT INTO @result1(subtype, total)
select DISTINCT top 2 t.subtype, t.total
from [test] t, [person] p
where (t.[record] = 'fc2765f2-ca90-48c2-a705-d2526c92d56d')
and p.[id] = t.[record]
and (t.[type] = 'SATII')
/*and (t.[rank_confirmed_subtype] = 1)*/
and (confirmed != 0 or confirmed IS NULL)
order by t.[total] desc

select total from @result1