表A, 具有的属性: 产品编号,产品种类,产品名称
表B, 具有的属性: 产品名称(和表A对应),商家名称现在我有商家名称,希望找出他所有的产品名称,但是按照这些产品的产品种类排列。
请教如何写mysql语句?谢谢

解决方案 »

  1.   

    select a.*
    from a,b 
    where a.产品名称=b.产品名称
    and b.商家名称='我有商家名称'
    order by a.产品种类
      

  2.   

    select a.* from a inner join b on a.产品名称=b.产品名称
    where b.商家名称='我有商家名称'order by a.产品种类
      

  3.   

    select a.*
    from a,b 
    where a.产品名称=b.产品名称
    and b.商家名称='我有商家名称'
    order by a.产品种类
      

  4.   

    select a.产品名称
    from a,b 
    where a.产品名称=b.产品名称
    and b.商家名称='我有商家名称'
    order by a.产品种类
      

  5.   

    select a.* from a,b
    where a.产品名称=b.产品名称
    and a.商家名称=b.商家名称
    order by a.产品种类;