列出商品分类ID为1商品类型属性ID为221的所有能单独销售的上架的普通商品的goods_attr_id(具体商品的属性表的goods_attr_id), attr_id(商品类型属性表的attr_id), attr_value(该具体属性的值)三个字段的值
select a.goods_attr_id, a.attr_id, a.attr_value as attr_value from ecs_goods_attr as a, ecs_goods as g where (g.cat_id in ('1') or g.goods_id in ('')) and g.goods_id = a.goods_id and g.is_delete = 0 and g.is_on_sale = 1 and g.is_alone_sale = 1 and a.attr_id = 221 order by g.goods_id desc, a.attr_id asc, a.goods_attr_id asc
select a.goods_attr_id, a.attr_id, a.attr_value as attr_value from ecs_goods_attr as a, ecs_goods as g where (g.cat_id in ('1') or g.goods_id in ('')) and g.goods_id = a.goods_id and g.is_delete = 0 and g.is_on_sale = 1 and g.is_alone_sale = 1 and a.attr_id = 221 group by attr_value order by g.goods_id desc, a.attr_id asc, a.goods_attr_id asc
select min(a.goods_attr_id) as goods_id, a.attr_id, a.attr_value as attr_value from ecs_goods_attr as a, ecs_goods as g where (g.cat_id in ('1') or g.goods_id in ('')) and g.goods_id = a.goods_id and g.is_delete = 0 and g.is_on_sale = 1 and g.is_alone_sale = 1 and a.attr_id = 221 group by attr_value order by g.goods_id desc, a.attr_id asc, a.goods_attr_id asc