多表查询时,要给表名起别名,给字段名其别名(当两个表含有重复字段时) select p.name, c.name, pid from products p, cats c;//得到的结果为笛卡尔乘积 select p.name as pname, p.price, p.desn, p.num from products p, cats c where c.id = p.cid ;//查询所有商品属于哪个分类 select p.name as pname, p.price, p.desn, p.n…