[英]How to determine if a string from one column is in another column?
I need to see if a string from one column is located in another column. 我需要查看一列中的字符串是否位于另一列中。 What's a good way to do that please?
请问有什么好方法吗?
Table: 表:
Desired Results: 所需结果:
SQL: SQL:
DROP TABLE ##SCHOOLS
CREATE TABLE ##SCHOOLS(
SchoolName varchar(50),
ChoiceSchool varchar(50),
)
INSERT INTO ##SCHOOLS
(SchoolName, ChoiceSchool)
VALUES
('Smith HS', 'Smith'),
('Jones High', 'Jones'),
('Eagle Elementary School', 'Eagle'),
('Hawk ES', 'Dunham'),
('No241', 'Harris'),
('Brookfield Middle', 'Brookfield')
SELECT
ChoiceSchool
,SchoolName
FROM ##SCHOOLS
Thank you for your help. 谢谢您的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.