请教一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”要比“&&”或“||”好? 一个WORDPRESS主题,里面有个网址没办法删除。真是奇怪。 xmlrpc.php 源码在哪改 PHP用curl函数POST请求到ASP页面提示无效请求 discuz上传功能?求救!!!! 关于留言版问题 近来,本人做php的手机网站,用WAP2。0版面在手机看老变形 对这大半年的开发做个的总结 MYSQL求和问题,急 为什么Call to undefined function mysql_connect()我设置没有问题 PHP如何读XML里的数据写入到MYSQL数据库?! 计数器问题,你一定会。 如何保存用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即可。