需要一些帮助,我想在prodprice表中加总价格并将其添加到prodcost表中的a_cost,b_cost和c_cost,其中main_item是00002在prodcomb中,00002的secondary_item是00001,现在是0000 in prodbm在main_item中有2个secondary_item 00005和00006这两个价格在prodprice中,我想在那里加价并加上a_cost,b_cost和c_cost。
结果如下所示,unitprice由a_cost + b_cost + c_cost + sumprice组成。
+-----+-----------+
| qty | unitprice |
+-----+-----------+
| 2 | 23.50 |
+-----+-----------+
prodprice
+-------+------+
| item | price|
+-------+------+
| 00005 | 5.00 |
+-------+------+
| 00006 | 3.50 |
+-------+------+
prodbm
+-----------+----------------+
| main_item | secondary_item |
+-----------+----------------+
| 00001 | 00005 |
+-----------+----------------+
| 00001 | 00006 |
+-----------+----------------+
prodcomb
+-----------+----------------+-----+
| main_item | secondary_item | qty |
+-----------+----------------+-----+
| 00002 | 00001 | 2 |
+-----------+----------------+-----+
prodcost
+-------+--------+--------+--------+-------+
| item | a_cost | b_cost | c_cost | m_cost|
+-------+--------+--------+--------+-------+
| 00001 | 5 | 5 | 5 | 6 |
+-------+--------+--------+--------+-------+
提前谢谢。
答案 0 :(得分:0)
应该是
for path in ('some_path/rest//','some_path/rest\\','some_path/rest','some_path/rest/','some_path/rest\\'):
print path + ' -> ' + re.sub(r"some_path[\\\\/]+rest(?:([\\\\/])(?=\1))?", 'FILTER', path)