请问,检索一个表 一个表字段为:T1,另一个表的字段和第一个表字段一样: T1;现在想检索生成出一个表,是T1,B1;如果第一个表的T1值在第二个表中T1有出现,就返回B1为真,反之为假.这个查询出生的表怎么实现? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select a.T1,b1=case exists(select * from tb2 where a.t1=t1 ) then 1 else 0 endfrom tb1 a 消息 156,级别 15,状态 1,第 3 行关键字 'exists' 附近有语法错误。消息 156,级别 15,状态 1,第 3 行关键字 'then' 附近有语法错误。 select a.T1,b1=case when exists(select * from tb2 where a.t1=t1 ) then 1 else 0 endfrom tb1 a select a.T1,b1=case when exists(select * from tb2 where a.t1=t1 ) then 1 else 0 endfrom tb1 a select distinct a.T1, b1=case when exists(select * from tb2 where a.t1=t1 ) then 1 else 0 end from tb1 a 如果表中不包含 T1 值为 NULL 的记录:select A.T1,B1=(case when B.T1 is null then '假' else '真' end)from Aleft join Bon A.T1=B.T1 select distinct a.T1, case when exists(select * from tb2 where a.t1=t1 ) then '真' else '假' end as b1from tb1 a select t1,b1= case when exists (select 1 from 表2 where 表1.t1=表2.t1) then '真' else '假' end from 表1 select a.T1, case when exists(select * from 表B where a.t1=t1 ) then '真' else '假' end as B1from 表A a 你好,能不能请教一个问题,就是你回复的这个sql code框框是怎么弄进来的,我不知道怎么弄,是不是很白痴,不过确实不懂...请教中.... 回复内容第一排 找到插入源代码 选择里面的SQL 新人求助sysindexes表问题,谢谢高手们 TOAD for mssql不能连接 我是个菜鸟,请各位大侠给各好点的教程 某一日期字段要选择这样的值, 如:0701-0706,0708,0710 , (表示07年1月到6月, 或者07年8月,或者07年10月) , 如何写SQL的函数来实现? 那位大侠告诉小弟这sql语句怎么写啊 请问:如何提取到表里面重复最多的值? SQL.log 是什么文件上,如何删除 时间比较问题 装sqlserver2000时出现的问题 高手检查一下这个游标的写法错在哪里 请教简单的数据导出问题 oracle语句出错不知原因,在线等,急。
a.T1,
b1=case exists(select * from tb2 where a.t1=t1 ) then 1 else 0 end
from tb1 a
关键字 'exists' 附近有语法错误。
消息 156,级别 15,状态 1,第 3 行
关键字 'then' 附近有语法错误。
a.T1,
b1=case when exists(select * from tb2 where a.t1=t1 ) then 1 else 0 end
from tb1 a
a.T1,
b1=case when exists(select * from tb2 where a.t1=t1 ) then 1 else 0 end
from tb1 a
a.T1,
b1=case when exists(select * from tb2 where a.t1=t1 ) then 1 else 0 end
from tb1 a
A.T1,B1=(case when B.T1 is null then '假' else '真' end)
from
A
left join
B
on
A.T1=B.T1
distinct a.T1,
case when exists(select * from tb2 where a.t1=t1 ) then '真' else '假' end as b1
from
tb1 a
then '真' else '假' end
from 表1
a.T1,
case when exists(select * from 表B where a.t1=t1 ) then '真' else '假' end as B1
from 表A a
你好,能不能请教一个问题,就是你回复的这个sql code框框是怎么弄进来的,我不知道怎么弄,是不是很白痴,不过确实不懂...
请教中....
回复内容第一排 找到插入源代码 选择里面的SQL