问你们 个问题:
表a 列1 表b 列2
a b
c aa
b aaa
形成表C
列1 列2
a aa
a aaa
c <null>
就是说从表1 中匹配与表2 中相似的值,a 与 aa 相似形成一记录。a与aaa相似生成一记录. b与b 相同不能生成 。
怎么写SQL 语句
表a 列1 表b 列2
a b
c aa
b aaa
形成表C
列1 列2
a aa
a aaa
c <null>
就是说从表1 中匹配与表2 中相似的值,a 与 aa 相似形成一记录。a与aaa相似生成一记录. b与b 相同不能生成 。
怎么写SQL 语句
解决方案 »
- MSSQL2000存储过程,传递参数出错!
- 高分求如何解析SQL语句。!!!!!!!!!!!在线急等 谢谢
- 执行存贮过程返回记录集,为何存贮过程中不加:set nocount on就不会返回记录集呢?
- 请教一个奇怪的问题。我的sql server 2000 开的 1433端口为telnet不到.
- 问一下,关于数据库sqlserver2005的ldf文件过大的问题!
- 判断缴费是否过期。在线等,急急!!谢谢!!
- 加了(nolock)还是锁表,怎么才能彻底解决select锁表
- 如何把数据库的数据复制一部分下来?
- 数据库设计问题?
- 向各位高手请教SQL SERVER2000的连接问题
- 急 !~~~~~~
- 请帮帮忙看一下这个SQL为什么不对~(涉及int和nvarchar的转换)
from a,b
where a.列1<>b.列2
and b.列2 like rtrim(a.列1)+'%'
from a,b
where a.列1<>b.列2
and left(b.列2,len(a.列1))=a.列1
列1 varchar(10)
)
insert @a
select 'a'
union all select 'c'
union all select 'b'declare @b table (
列2 varchar(10)
)
insert @b
select 'b'
union all select 'aa'
union all select 'aaa'--1
select *
from @a a left join @b b
on b.列2 like rtrim(a.列1)+'%'
where b.列2 is null or a.列1<>b.列2--2
select *
from @a a left join @b b
on left(b.列2,len(a.列1))=a.列1
where b.列2 is null or a.列1<>b.列2
declare @x table(f2 varchar(10))
insert @t select 'a' union all select 'c' union all select 'b'
insert @x select 'b' union all select 'aa' union all select 'aaa'
select f1,f2 from @t a
full join @x b
on f2 like f1+'[a-z]%'
where not exists(select 1 from @x c where f2=a.f1) and f1 is not null/*
f1 f2
a aa
a aaa
c NULL
*/