一共2个表
一个表是products(分类):
id
title
contont
addtime
另一个表是details(详细信息)
id
title
contont
img
addtime
type
我现在添加详细信息的时候是type对应分类表的id
我现在想查寻如果点确定就相信按分类表显示详细信息!!!不知道SQL语句怎么写了
希望大侠帮忙下!!!!!

解决方案 »

  1.   

    select *,(select title from products where products.id=details.type) as typeName from details order by type
      

  2.   

    大哥,不对啊!是不显示products表里的title,就是点确定显示按type显示details的详细信息
      

  3.   

    select  b.id, b.title,b.contont,b.img,b.addtime,a.type from products as a ,datails as b where a.id = b.type
      

  4.   

    一个表是products(分类):
    id
    title
    contont
    addtime
    另一个表是details(详细信息)
    id
    title
    contont
    img
    addtime
    typeselect a.*,b.* from details a join products b on a.type=id order by b.type