表一 表二
aa bb cc dd ee ff gg hh
新城市 反对 广泛 冯伟 新城市 大师傅 广泛的 风格
城市之心 发和 飞过 冯伟 新城市 地方个 个 恢复
财富中心 发和 飞过 刘一 卡卡之都 地方 广泛 活动
春西路 发和 飞过 冯伟 春西路,财富中心 大概 发 恢复
擦地方啊 发和 飞过 刘一 城市之心,鬼风疙瘩 gfd 大概 恢复感
卡卡之都 发和 飞过 冯伟 擦地方啊 反对 发 搞活
鬼风疙瘩 发和 飞过 张一 财富中心 感到法 和22 而22比说我是冯伟 登陆系统后名字保存在session("name")中, aa表示项目 dd表示项目负责人
请问能不能把表二里 只要和我有关的项目记录查询出来???帮帮忙```非常感激
aa bb cc dd ee ff gg hh
新城市 反对 广泛 冯伟 新城市 大师傅 广泛的 风格
城市之心 发和 飞过 冯伟 新城市 地方个 个 恢复
财富中心 发和 飞过 刘一 卡卡之都 地方 广泛 活动
春西路 发和 飞过 冯伟 春西路,财富中心 大概 发 恢复
擦地方啊 发和 飞过 刘一 城市之心,鬼风疙瘩 gfd 大概 恢复感
卡卡之都 发和 飞过 冯伟 擦地方啊 反对 发 搞活
鬼风疙瘩 发和 飞过 张一 财富中心 感到法 和22 而22比说我是冯伟 登陆系统后名字保存在session("name")中, aa表示项目 dd表示项目负责人
请问能不能把表二里 只要和我有关的项目记录查询出来???帮帮忙```非常感激
7L
select b.* from a,b where charindex(a.aa,b.ee)>0 and a.dd='冯伟'
declare @表一 table (aa varchar(8),bb varchar(4),cc varchar(4),dd varchar(4))
insert into @表一
select '新城市','反对','广泛','冯伟' union all
select '城市之心','发和','飞过','冯伟' union all
select '财富中心','发和','飞过','刘一' union all
select '春西路','发和','飞过','冯伟' union all
select '擦地方啊','发和','飞过','刘一' union all
select '卡卡之都','发和','飞过','冯伟' union all
select '鬼风疙瘩','发和','飞过','张一'select * from @表一declare @表二 table (ee varchar(20),ff varchar(6),gg varchar(6),hh varchar(6))
insert into @表二
select '新城市','大师傅','广泛的','风格' union all
select '新城市','地方个','个','恢复' union all
select '卡卡之都','地方','广泛','活动' union all
select '春西路,财富中心','大概','发','恢复' union all
select '城市之心,鬼风疙瘩','gfd','大概','恢复感' union all
select '擦地方啊','反对','发','搞活' union all
select '财富中心','感到法','和22','而22'select * from @表二select b.* from @表一 a, @表二 b where charindex(a.aa,b.ee)>0 and a.dd='冯伟'
/*
ee ff gg hh
-------------------- ------ ------ ------
新城市 大师傅 广泛的 风格
新城市 地方个 个 恢复
城市之心,鬼风疙瘩 gfd 大概 恢复感
春西路,财富中心 大概 发 恢复
卡卡之都 地方 广泛 活动
*/
select * from a,b where a.aa = b.ee and dd = '冯伟'