查找多行 [英] Lookup with multiple rows
问题描述
您好,
我使用的是SQL Server 2014我有两个表,一个是项目主表 其他客户销售。在项目主人 我有一个列调用项目,从客户销售我有以下列customer,salesitem,salesAmount。 在我的
报表中,主要表格是商品主数据我想要显示商品主数据中的所有商品,无论商品是否已售出我都进行了查询,但我只获得了该行的一行。 我想展示可能有多个客户销售的商品。
我们将不胜感激任何帮助。 谢谢。
I am using SQL Server 2014 I have two tables one is the item master the other customer sales. In the item master I have a column call item and from the customer sales I have the following columns customer, salesitem, salesAmount. In my report the primary table is item master I want to show the all items in the item master regardless if an item is sold I did a lookup, but I am only getting one row of the product only. I want to show the item with possible multiple customer sales. Any help will be appreciated. Thank you.
推荐答案
你好donalejandro
Hi donalejandro
根据你的描述,似乎你有用函数lookup(),它的关系是一对一的,所以它只会返回一个值。
According to your description , seems that you have use the function lookup() which the relationship is one to one, so it would only return one value .
如果可能的话你可以尝试使用lookupset()函数代替它可以返回多个价值。
If possible you could try to use the lookupset() function to instead which could return multiple value.
请参阅:
LookupSet功能
希望它可以帮到你。
最诚挚的问候,
Eric Liu
这篇关于查找多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!