SQL产品查询表

时间:2018-11-23 21:23:07

标签: sql-server tsql

我问这个问题是我的主表的小模型。

我有一个表Neue IP Addresse: 1.2.3.4 Get IP: 1.2.3.4 Neue IP Addresse: 5.6.7.8 Get IP: 5.6.7.8 1.2.3.4 == 5.6.7.8 = ... in operator == ... this Adress: 1.2.3.4 compareTo Adress: 5.6.7.8 this first block: 1 compareTo first block: 5 this first block second printout: 5 <------- this should be 1 1 ,我想要一个来自SQL查询的结果表:

Product

Color | existing Color count | existing sizes from this color ----------+------------------------+-------------------------------- red | 20 | 3 black | 12 | 4 表具有Product列。

我写了这个SQL语句:

[Id, Name, Color, Size, Price]

1 个答案:

答案 0 :(得分:2)

 Select color,count(color),count(distinct size) from table 
 group by color;
  

这是您想要的吗?