select t1.产品名称,t2.产品属性,t3.属性规格 from 产品表 t1,属性表 t2,产品属性表 t3 where t1.产品ID=t3.产品ID and t2.属性ID=t3.属性ID
select t1.产品名称,t2.产品属性,t3.属性规格 from 产品表 t1,属性表 t2,产品属性表 t3 where t1.产品ID=t3.产品ID and t2.属性ID=t3.属性ID
select distinct t1.产品名称,t2.产品属性,t3.属性规格 from 产品表 t1,属性表 t2,产品属性表 t3 where t1.产品ID=t3.产品ID and t2.属性ID=t3.属性ID
select t1.产品名称,t2.产品属性,t3.属性规格 from 产品表 t1,属性表 t2,产品属性表 t3 where t1.产品ID=t3.产品ID and t2.属性ID=t3.属性ID
Select 产品表.产品名称,属性表.属性名称,产品属性表.属性规格 from 产品表 join 产品属性表 on 产品表.产品ID = 产品属性表.产品ID join 属性表 on 属性表.属性ID = 产品属性表.属性ID和楼上的大同小异~
select A,B,C from ( select *,Row_number()over(partition by A order by A)cnt from ( select N'手机' as A, N'宽度' as B, N'10' c union all select N'手机' as A, N'长度' as B, N'15' c union all select N'电脑' as A, N'重量' as B, N'22' c union all select N'电脑' as A, N'颜色' as B, N'黑' c )A)A where cnt =1
from 产品表 t1,属性表 t2,产品属性表 t3
where t1.产品ID=t3.产品ID and t2.属性ID=t3.属性ID
from 产品表 t1,属性表 t2,产品属性表 t3
where t1.产品ID=t3.产品ID and t2.属性ID=t3.属性ID
from 产品表 t1,属性表 t2,产品属性表 t3
where t1.产品ID=t3.产品ID and t2.属性ID=t3.属性ID
from 产品表 t1,属性表 t2,产品属性表 t3
where t1.产品ID=t3.产品ID and t2.属性ID=t3.属性ID
from 产品表 join 产品属性表 on 产品表.产品ID = 产品属性表.产品ID
join 属性表 on 属性表.属性ID = 产品属性表.属性ID和楼上的大同小异~
from
(
select *,Row_number()over(partition by A order by A)cnt
from
(
select N'手机' as A, N'宽度' as B, N'10' c
union all
select N'手机' as A, N'长度' as B, N'15' c
union all
select N'电脑' as A, N'重量' as B, N'22' c
union all
select N'电脑' as A, N'颜色' as B, N'黑' c
)A)A
where cnt =1
select distinct 产品表.产品名称.......