sql两列合并成一列 - MS-SQL Server / 基础类
ItemManage_DemandPlan(需求表):
id plantype
1 前期调研
2 总体设计
3 需求分析
4 数据库设计
ItemManage_DevelopPlan(开发表)
id I_Type
1 编码
2 测试
3 bug修改
4 验收
查询出来的结果为
id content
1 前期调研
2 总体设计
3 需求分析
4 数据库设计
1 编码
2 测试
3 bug修改
4 验收
求哪位大哥些详细点
union all?
UNION联合查询
SQL code:
select id, plantype from ItemManage_DemandPlan union all
select id,I_Type from ItemManage_DevelopPlan
select * from ItemManage_DemandPlan
union all
select * from ItemManage_DevelopPlan
SQL code:
select * from ItemManage_DemandPlan
union all
select * from ItemManage_DevelopPlan
SQL code:
select a.*, b.* from ItemManage_DemandPlan a, ItemManage_DevelopPlan b
两列合并
select col1 + col2 from table
SQL code
Code highlighting produced by
相关问答:
现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......
tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......
请教高手:
以下是数据库中的三条记录,英文为字段名称
id planname TaskBeginTime Status
329 2010年03 ......
需求如下:
学院 academy(aid,aname)
班级 class(cid,cname,aid)
学生 stu(sid,sname,aid,cid)
住宿区 region(rid,rname)
宿舍楼 build(bid,rid,bnote) bnote是‘男’/‘女’
宿舍 dorm(did,rid,bid,bedn ......