请教一sql语句 select a.id from (select * from a where a.title=1) a,(select * from b where b.title=1) b where a.id=b.aid 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ERROR 1064: You have an error in your SQL syntax near 'select * from a where a.title=1) a,(select * from b where b.title=1) b where a.i' at line 1 select *from ainner join b on a.id=b.aidwhere a.title=1 or b.title=1 SELECT distinct a.*,b.* FROM a left join b on a.id=b.aid WHERE (a.title=1 || b.title=1) SELECT a.*,b.* FROM a left join b on a.id=b.aid WHERE (a.title=1 || b.title=1) group by a.id select distinct a.id from a,b where (a.title=1 || b.title=1) && a.id=b.aid select * from subtable where Id in (select max(s.id) from parenttable p,subtable swhere s.parent_id =p.id )可能效率不太高 看看SQL说明书,用LeftJoin还是rightJoin,俺忘了PHP建站技术讨论网站:www.myhosts.cn select * from a where title in(select a.title from a a inner join b b on a.id=b.aid where a.title='1'and b.title='1') 嘿嘿,楼主的select a.id from a,b where (a.title=1 || b.title=1) && a.id=b.aid应该是对的,(最好 || => or , && => and )不认为出现重复结果是sql的问题,应该是数据本身就是有重复的如果要强制不重复,加distinct即可。 加过distinctrow,但是7M的数据表生生读死了。数据不会有重复,测试的时候就添了两条数据,读出来了十几条。请教,为什么“and”或“or”要比“&&”或“||”好? 专题讨论:php代码缓存和浏览器缓存的差异,区别是什么? robots.txt能不能阻止非站内链接 c# post到一个php 页面,返回"ERROR - not sent. Try again." 一个小问题 关于一个htaccess重写的奇怪问题。朋友们来看看 目前有个工行在线支付接口解决的外包的活,那位能解决?资料我全部提供 请教gd库最多支持多少为像素? 给书店做个电子商务网站,有N多问题请教 文章流量统计,是否必须每次浏览都读写一次数据库? volist嵌套 计数器问题,你一定会。 如何保存用GD生成出来的图片到本地
itle=1) a,(select * from b where b.title=1) b where a.i' at line 1
from a
inner join b on a.id=b.aid
where
a.title=1 or b.title=1
where s.parent_id =p.id )
可能效率不太高
应该是对的,(最好 || => or , && => and )
不认为出现重复结果是sql的问题,应该是数据本身就是有重复的
如果要强制不重复,加distinct即可。