问题描述
我猜这对你们来说很简单但是我是sql的新手,我不确定如何创建这个查询(我必须在SQL中做)。
我想在一个查询中显示哪个供应商销售所有种类的植物。例如,我希望查询显示结果如下:
供应商种类
PlantCO植物,树,花
(连续不连续,可能是每个物种分开排列)。
我试过计算一下,计算出售所有物种的供应商数量然而,它并没有太好用:
SELECT DISTINCT LEVERANC.LEV_NAAM,Count(PLANTEN.PLANTNAAM)作为PLANTNAAM
来自PLANTEN INNER的
在LETAN.ART_CODE = OFFERTES.ART_CO
GROUP BY LEVERANC.LEV_NAAM;
(JOVER上,LEVERANC INNER JOIN OFFERT LEVERANC.LEV_CODE = OFFERTES.LEV_CODE)对不起,这是荷兰的数据,plantnaam是工厂,leveranc是供应商)。
我希望这是足够的信息,如果有人能给我提供建议或解决方案,我会非常感激。谢谢你:)
Hi,
I am guessing this is something simple to you guys however I am new to sql and am unsure how to create this query (I must do it in SQL).
I am wanting to show in one query which supplier sells all species of plants. So for instance I want the query to display the results like so:
Supplier Species
PlantCO Plant, Tree, flower
(not neccessarily in a row, could be every species in separate row).
I tried a count to count the number of suppliers which sell all species, however, it didn''t work out too good:
SELECT DISTINCT LEVERANC.LEV_NAAM, Count(PLANTEN.PLANTNAAM) AS PLANTNAAM
FROM PLANTEN INNER JOIN (LEVERANC INNER JOIN OFFERTES ON LEVERANC.LEV_CODE = OFFERTES.LEV_CODE) ON PLANTEN.ART_CODE = OFFERTES.ART_CO
GROUP BY LEVERANC.LEV_NAAM;
(sorry it is Dutch data, plantnaam being the plant and leveranc being the supplier).
I hope this is enough information and if anybody can provide me with advice or a solution I would appreciate it a lot. Thankyou :)
推荐答案
这篇关于SQL问题,请尽可能帮助。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!