Selecting records in SQL Server

廉价感情. 提交于 2019-12-11 17:52:29

问题


I have table with two columns with this sample data:

Column1         Column2
------------------------
A                B
A                C
A                D
R                B 
R                D
S                E

If I pass the input value of Column2='B', it will display these records:

Column1         Column2
-------------------------
A                B
A                C
A                D
R                B 
R                D

because Column2 'D' Contains 'A' in column1 and 'R' in Column1. So it fetches all the records which contains 'A' and 'R'

Suppose if I pass an input if Column2='C', it will display these records

Column1         Column2
-------------------------
A                B
A                C
A                D

because Column2 'C' Contains 'A' in Column1. So it fetches all the records which contain 'A'.

Original table contains > 100k records. So we will give any input for column2.

来源:https://stackoverflow.com/questions/51289488/selecting-records-in-sql-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!