易截截图软件、单文件、免安装、纯绿色、仅160KB

【SOS】 MSSQL数据库问题 - MS-SQL Server / 疑难问题

select id,name,type from A union all 
select id,name,type from B union all 
select id,name,type from C union all where ???
----------------------------------------------------
 1,张三,会员
 2,李四,钻石
 7,王五,普通
 3,张三,会员
 5,张三,会员
---------------------------------------
 查询时 “会员” 的用户列 
  Where 后面怎么写。。。
  type='会员' 不行


成功后 即结贴。。。。。。。。。。。。。

A.type = '' or B.type='' or C.type=''


先结帖再试吧

引用
A.type = '' or B.type='' or C.type=''

  都要写吗?
  我又多张表

SQL code:
select id,name,type from A where [TYPE]='会员'
union all
select id,name,type from B where [TYPE]='会员'
union all
select id,name,type from C where [TYPE]='会员'


select * from(
select id,name,type from A union all  
select id,name,type from B union all  
select id,name,type from C) t where type='会员'

引用
SQL code
SELECT * from (
select id,name,type from A union all
select id,name,type from B union all
select id,name,type from C
)T where [TYPE]='会员'

  T是


相关问答:

数据以xml格式返回 - MS-SQL Server / 应用实例

从数据库中查询一张表的数据
select 部门,姓名 from tb
如何才能生成下面的xml格式
XML code:
<folder state="unchecked" label="全部">
   <folder state="unchecked&qu ......

请教SQLSERVER的两个问题 - MS-SQL Server / 疑难问题

1。怎样使xp_cmdshell能完整输出超过255个字符的字符串。
2。select 时,检索速度是与from后的 TABLE顺序有关,还是与where条件的顺序有关(TABLE数据多少 )
在系统属性设定里有个选项,可以修改单字段输出字数限制. ......

sql 问题 - MS-SQL Server / 基础类

需求如下:
学院 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 ......

一条 SQL - Oracle / 基础和管理

有这样一条SQL
 Select Get_Costtaxrate(col1), Get_Tcostvalue(col1) from a
 
其中Get_Costtaxrate、Get_Tcostvalue都是函数,这两个函数里面都是查找一个大表,Get_Tcostvalue还需要调用Get_C ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号