数据库A1,表a1
+----+------+
| id | num |
+----+------+
| 1 | 10 |
+----+------+数据库A2,表a1
+----+------+
| id | num |
+----+------+
| 1 | 35 |
+----+------+上面写错了
+----+------+
| id | num |
+----+------+
| 1 | 10 |
+----+------+数据库A2,表a1
+----+------+
| id | num |
+----+------+
| 1 | 35 |
+----+------+上面写错了
我的具体表达式是
SELECT
allowed.info_hash,a.seeders+b.seeders,a.leechers+b.leechers,a.completed+b.completed,bname,badded,bsize,bcategory,buser,btop,btj from xbt_files a join A2.xbt_files b USING(info_hash) left join allowed USING(info_hash) LEFT JOIN allowed_ex USING(info_hash) LEFT JOIN xbt_files USING(info_hash)但只能读取A2个数据库有的记录,而A1的有的A2没有的无法显示另外,我设置
$row[0] is info_hash
$row[1] is seeders
$row[2] is leechers
$row[3] is completed
$row[4] is bname
$row[5] is badded
$row[6] is bsize
$row[7] is bcategory
$row[8] is buser
$row[9] is btop
$row[10] is btj但无任何变化,还是从A1里读出,并无累加,怎么办.........
allowed.info_hash,
a.seeders+IFNULL(b.seeders,0),
a.leechers+IFNULL(b.leechers,0),
a.completed+IFNULL(b.completed,0),
bname,badded,bsize,bcategory,buser,btop,btj
FROM xbt_files a
LEFT JOIN A2.xbt_files b USING(info_hash)
LEFT JOIN allowed USING(info_hash)
LEFT JOIN allowed_ex USING(info_hash)
LEFT JOIN xbt_files USING(info_hash)
FROM allowed
LEFT JOIN xbt_files a
USING ( info_hash )
LEFT JOIN allowed_ex
USING ( info_hash )
LEFT JOIN xbt_files
USING ( info_hash )
LEFT JOIN xbt.xbt_files b
USING ( info_hash )现在显示正确了,感谢