早上好,我有以下查询,它创建了一个临时表,我想要的是这个表是永久的,每当其他表被更新时,这个表就会自动更新,我认为有一种简单的方法可以做到这个,但我刚刚忘记了。
查询链接 3 个表
Select S.[Silks_Skey], MC.[MajorColour_Skey]
from [dbo].[Silks] S
inner join [dbo].[SubColour] SC on CHARINDEX(SC.[SubColour],S.[SilksName]) <> 0
inner join [dbo].[MajorColour] MC on SC.[MajorColour] = MC.[MajorColour]
UNION ALL
Select S.[Silks_Skey], MC.[MajorColour_Skey]
from [dbo].[Silks] S
inner join [dbo].[MajorColour] MC on CHARINDEX(MC.[MajorColour],S.[SilksName]) <> 0
ORDER BY S.[Silks_Skey]
将链接表变成永久表
Silks_Skey MajorColour_Skey
1 7
1 8
2 2
2 8
2 9
3 4
3 5