数据库结构如何?
不要说又是那种parent_id那种无级分类,害死人

解决方案 »

  1.   

    是这样的。
    着的设计为什么会害死人呢?是否这样设计会更合理点:把类别用特定字符连接起来,t1:t11:t112。
      

  2.   

    你需要给出类别t1、t11、t112是怎样存放的
      

  3.   

    类别表:type
    id
    name
    parentID产品表:product
    id
    title
    type     引用type的id
      

  4.   

    呵呵,被楼上同学说对了。果然是这种结构你只能先用递归的方法取出t1的所有子类,然后用
    where type in( ...)的形式来取得产品
      

  5.   

    select * from product p , type t where p.type=t.id and substring(t.parentID, 2) like 't1%'