标题: select()如何实现where not exsits
Freebear
新手上路
Rank: 1



UID 914
精华 0
积分 0
帖子 15
翻译 0
原创 0
阅读权限 10
注册 2008-3-19
状态 离线
发表于 2008-8-19 11:56  资料  短消息  加为好友 
select()如何实现where not exsits

用select()怎么写如下的SQL:
select * from A_table where not exsits (select * from B_table where A_table.id=B_table.id);

其实可以用数据库适配器的query(),直接放入上面的语句也行,但就是看Zend_Db_Select()能不能写出来?

顶部
wulijun01234
PHPEye Developer
Rank: 8Rank: 8



UID 1872
精华 3
积分 30
帖子 7
翻译 15
原创 3
阅读权限 1
注册 2008-8-15
来自 北京
状态 离线
发表于 2008-8-19 16:06  资料  主页 短消息  加为好友  QQ
用两个select不就拼出来了吗

顶部
freebear
新手上路
Rank: 1



UID 914
精华 0
积分 0
帖子 15
翻译 0
原创 0
阅读权限 10
注册 2008-3-19
状态 离线
发表于 2008-8-19 16:50  资料  短消息  加为好友 


QUOTE:
原帖由 wulijun01234 于 2008-8-19 16:06 发表
用两个select不就拼出来了吗

愿闻其详

顶部
itlong
新手上路
Rank: 1



UID 754
精华 0
积分 0
帖子 4
翻译 0
原创 0
阅读权限 10
注册 2008-1-20
状态 离线
发表于 2008-8-25 09:58  资料  短消息  加为好友  添加 itlong 为MSN好友 通过MSN和 itlong 交谈
如果不行,可以分两次查询。第一次查出id = array()
再用where id not exists id

顶部
 


PHPEye开源社区


当前时区 GMT+8, 现在时间是 2009-1-10 04:45

    Powered by Discuz! 5.5.0  © 2001-2007 Comsenz Inc.
Processed in 0.178141 second(s), 6 queries , Gzip enabled

清除 Cookies - 联系我们 - PHPEye开源社区 - Archiver