重复查询以生成报告 [英] Repetition of query to produce report
问题描述
我正在创建物料清单程序.
I am creating a bill of materials program.
有两个名为Products
和Sub_Products
的主表.
在Products
表中,字段为(Product_Name
,Code
).
在Sub_Products
表中,字段为(Code
,Sub_Name
).
In the Products
table, the fields are (Product_Name
, Code
).
In the Sub_Products
table, the fields are (Code
, Sub_Name
).
这些表与代码链接,即:一个product
由许多sub_product
组成,每个sub_product
也是一个product
,从而使其具有许多sub_product
.
The tables are linked with code, i.e.: one product
is made up of many sub_product
s, each sub_product
is a product
as well, making it have many sub_product
s.
我创建了一个读取product
并获取其sub_product
的查询.我需要查询以将Sub_Name
与Product_Name
进行比较,然后检查更多的sub_product
,
继续直到找不到更多的sub_product
.
I have created a query that reads a product
and gets its sub_product
s. I need a query to compare Sub_Name
with Product_Name
and then check more sub_product
s,
continuing until no more sub_product
s are found.
有什么想法吗?
推荐答案
我想您将不得不使用脚本而不是SQL查询来遍历它们.假设产品可以嵌套超过3个级别.
I guess you will have to use a script rather than SQL query to loop through them. Assuming that the products can be nested more than 3 levels.
这篇关于重复查询以生成报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!