sql 如何把多个列合成一个列,然后查询? 如何把多个列合成一个列,然后查询? 如一个表内有列名为: id,type,text,date 如何把 type,text,date 合成一个列 然后查询? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select type from 表名union allselect text from 表名union allselect datefrom 表名 select id,type+','+text+','+cast(date as varchar) from 表名 select id,type+','+text+','+cast(date as varchar) from 表名查询呢? select id,type+','+text+','+cast(date as varchar) from 表名查询呢?-------------------??? select id,type+','+text+','+cast(date as varchar) from 表名如: like '%a%' ??select id,type+','+text+','+cast(date as varchar) from 表名 where text like '%a%' select id,[type]+','+[text]+','+cast([date] as varchar) from 表名 where [text] like '%a%' 我想查的是组合到一块那个数据里的东西~!如下select id,[type]+','+[text]+','+cast([date] as varchar) as h from 表名 where h like '%a%' 我想查的是组合到一块那个数据里的东西~!如下select id,[type]+','+[text]+','+cast([date] as varchar) as h from 表名 where h like '%a%'但是不能使用~!我想了解的是如何查询 as 生成的组合列的内容 明白了:)select id,[type]+','+[text]+','+cast([date] as varchar) as h from 表名 where cast([date] as varchar) like '%a%' select id,[type]+','+[text]+','+cast([date] as varchar) as h from 表名 where h like '%a%'--------------------------where h like '%a%'不能用h作为条件 需要搜索的列名是:name,ip,info表名是: data搜索的关键字是任意的~! select * from (select [name]+','+[ip]+','+[info] as h from data ) awhere h like '%关键字%' select [name]+','+[ip]+','+[info] from where [name]+','+[ip]+','+[info] like '%关键字%' 创建表的时候一个计算列怎么调用另外一张表的数据 SQL Server有逻辑备份和恢复吗? 求一条与update有关的语句 求一SQL语句 关于异或的问题 求一条SQL查询语句 初学者请教各位老师! 怎样查看某个表所占用的空间大小? 关于多级汇总的问题(在线等待)---当场给分 被SELECT语句难住了 简单的问题,关于&字符的? 求教一条sql语句
union all
select text from 表名
union all
select datefrom 表名
查询呢?
查询呢?-------------------
???
select id,[type]+','+[text]+','+cast([date] as varchar) as h from 表名 where h like '%a%'
select id,[type]+','+[text]+','+cast([date] as varchar) as h from 表名 where h like '%a%'
但是不能使用~!我想了解的是如何查询 as 生成的组合列的内容
select id,[type]+','+[text]+','+cast([date] as varchar) as h from 表名 where cast([date] as varchar) like '%a%'
--------------------------
where h like '%a%'不能用h作为条件
(
select [name]+','+[ip]+','+[info] as h from data
) a
where h like '%关键字%'
where [name]+','+[ip]+','+[info] like '%关键字%'