select 变量=。。。 from 表
来源:互联网 发布:cocos2d js 官网 编辑:程序博客网 时间:2024/05/18 04:49
有表如下:
use [test]gocreate table A(id int,pid int);insert into A(id,pid) values(1,1);insert into A(id,pid) values(1,2);insert into A(id,pid) values(1,3);insert into A(id,pid) values(2,1);insert into A(id,pid) values(2,2);insert into A(id,pid) values(3,1);
如果
declare @str varchar(1000) = '';select @str = @str + ',' + CAST(pid as varchar(50)) from [A] where [id]=1;select right(@str,LEN(@str) - 1);
则有结果:
(无列名)
1,2,3
如果
select CAST(pid as varchar(50)) + ',' from [A] where [id]=1;
则有结果:
(无列名)
1,
2,
3,
觉得有点意思,select 变量=。。。 from 表 跟 select 。。。 from 表 差别这么大。前者好像会自动处理一个结果集。
- select 变量=。。。 from 表
- sf=select from
- mysql存储过程中使用select count(*) into 变量名 from +表+ where条件的用法
- select 1 from 表名
- select * from 表名 where 1=1
- select name from syscolumns where id=object_id(\'表名\')
- Select * from (select * from Table)
- 表数据的copy,insert into select/select into from
- hive select * from表没有数据, select 列 有数据
- strSQL = "Select * From " & strTableName & " Where False "
- JdbcTemplate (select * from xx where id = ?)
- select * from table where 1=1
- select * from table where 1=1
- select * from table where 1=1
- select * from table where 1=1
- select from table where 1=1
- select * from table where 1=1
- select * from sample where id = id
- 如何在mac下安装win7
- JAVA代码覆盖率检测工具-EMMA
- 第十三课堂作业
- 题目1069:查找学生信息
- 托管代码
- select 变量=。。。 from 表
- ArcGIS Runtime for Android 开发环境配置
- 需要改变
- async and await 简单的入门
- 题目1068:球的半径和体积
- JILK - CPU - (5) - CPU管理的内存模型
- oracle 11g PL/SQL Programming学习九
- 关于斐波那契数列的复杂度最低算法
- I/O端口的编址方式有几种?各有什么优缺点?