方法2更好。
你可以在mysql 里面尝试一下explain。
以下是我的分析数据(数据是自己加上的)
explain select * from good, good_category where good.cate_id = good_category.id;
+----+-------------+-------+--------+---------------+---------+---------+-------------+------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows |
+----+-------------+-------+--------+---------------+---------+---------+-------------+-----
| 1 | SIMPLE | e | ALL | NULL | NULL | NULL | NULL | 769 |
| 1 | SIMPLE | u | eq_ref | PRIMARY | PRIMARY | 4 | lvshi.e.uid | 1 |
+----+-------------+-------+--------+---------------+---------+---------+-------------+-----
一共要扫描769行
explain select * from good;
+----+-------------+---------+------+---------------+------+---------+------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------+------+---------------+------+---------+------+------+-------+
| 1 | SIMPLE | ez_case | ALL | NULL | NULL | NULL | NULL | 769 | |
+----+-------------+---------+------+---------------+------+---------+------+------+-------+
也扫描769行
所以说 是否join,不会影响扫描的数量
如果你是用方法一的话,就有多了一步php操作没有必要。