简体   繁体   English

如何选择表的列名,其中列数据的值中包含“%”?

[英]How to select the column names of a table where column data contains '%' in the values?

How to select the column names of a table where column data contains '%' in the values? 如何选择表的列名,其中列数据的值中包含“%”?

Eg: In the table COMP there are two columns(Addr, Comp_Name) which has data containing '%' in its string. 例如:表COMP中有两列(Addr,Comp_Name),其字符串中包含“%”的数据。 So my query should return those column_names(Addr, Comp_Name) 所以我的查询应该返回那些column_names(Addr,Comp_Name)

I dont get you right but i thing this will help you 我不正确,但我认为这对您有帮助

You can use the escape identifier 您可以使用转义标识符

--Queries

-- for %
select * from test_a where col1 like '%\%%' escape '\';

--for _ 
select * from test_a where col1 like '%\_%' escape '\';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何 select 列名来自 SQL 中另一个表的值? - How to select values where column names are from another table in SQL? 如何选择“ user_id”列所在的所有表名? - How to select all table names where a 'user_id' column is? 如何从一个表中选择与表中的列值相匹配的数据? - How do I select data from one table where column values from that table match the conatenated column values of another table? 如何检查/选择字符串是否包含表列值中的值? - How to check/select if a string contains value from a table column values? 如何选择行值作为另一个表的列名? - How to Select Row values as another table's column names? 从表中选择特定列的数据,其中查询返回列名称 - select data of specific column from table where column names are returned by query 选择不同的列A,其中列B包含所有必需的数据? - Select distinct column A where column B contains all required data? 如何排除[从列值以字母开头的表中选择*]? - How to exclude [select * from table where column values start with a letter]? 如何选择包含所选表的新列? - How to select a new column contains selected table? 如何从SQL的表中选择,其中一列中的元素仅包含另一列的特征,而另一列本身又包含两个特征? - How to select from a table in SQL where element in a column contains only one feature of another column which in turn contains two features in itself?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM