I have two tables as follows
我有两张表如下
Table 1
表格1
ServerName Details1 Details2 Details3
--------------------------------------
xyzG01p0 blah blah blah
abczG02p0 blah blah blah
efgG01S01 blah blah blah
dfgG06P0 blah blah blah
Table 2
表2
Classification Name
---------------------
G01p0 G01
G02p0 G02
G01S01 G01S0
G06P0 G06
I'm trying to find the classification from table2 which can be part of the servername from table1
. Is that possible? I need to identify for example, xyzG01p0 as G01 based on two tables and need to perform some actions based on that!
我试图从table2中找到分类,它可以是table1中servername的一部分。那可能吗?我需要根据两个表确定xyzG01p0为G01,需要根据它执行一些操作!
1 个解决方案
#1
4
You could use:
你可以使用:
演示
SELECT *
FROM table1 t1
JOIN table2 t2
ON t1.ServerName LIKE '%' + t2.Classification
But it will have poor performance, because it is nonSARG-able
但它的性能会很差,因为它不具备能力
#1
4
You could use:
你可以使用:
演示
SELECT *
FROM table1 t1
JOIN table2 t2
ON t1.ServerName LIKE '%' + t2.Classification
But it will have poor performance, because it is nonSARG-able
但它的性能会很差,因为它不具备能力