您好,首先我是一个 SQL 新手,需要一点帮助。我找不到和我一模一样的问题。
(select count(*) from table where Column_x like '%text1%')
(select count(*) from table where Column_x like '%text2%')
(select count(*) from table where Column_x like '%text3%')
所以我希望搜索返回
case 1 | Case 2 | Case 3
xtimes ytimes ztimes
任何帮助都会很棒,要么只显示查询结果,要么创建一个临时表。
干杯,
我找到的解决方案如下
Select * from(
(select count(*) as col1 from table where Column_x like '%text1%')col1,
(select count(*) as col2 from table where Column_x like '%text2%')col2,
(select count(*) as col3 from table where Column_x like '%text3%')col3
)