2017-07-28 69 views
0

我需要知道哪个表充当中介以实现这些实体之间的多对多关系。在vTiger 6.5中:哪个表存储属于报价单的产品?

我知道存储产品的表格是vtiger_products,并且保留引号的表格是vtiger_quotes但我不知道哪个表格与两者都有关系,因此我的查询不完整。

所以......

SELECT * FROM vtiger_quotes 
INNER JOIN vtiger_products INNER JOIN table_relates_both 
ON vtiger_quotes.quoteid = table_relates_both.quoteid 
AND vtiger_products.productid = table_relates_both.productid 
WHERE vtiger_quotes.potentialid = ? 

什么的table_relates_both的真实姓名?

回答

2

vtiger_inventoryproductrelvtiger_quotesvtiger_products

下面之间的媒介表是vtiger_inventoryproductrel的结构,其中id列充当的Quotes外键,OpportunityInvoice

enter image description here

如果你想获取与特定机会行情,那么你需要执行下面的查询:

SELECT {your required field goes here} FROM vtiger_inventoryproductrel INNER JOIN vtiger_quotes 
    ON vtiger_quotes.quoteid = vtiger_inventoryproductrel.id 
    WHERE vtiger_quotes.potentialid = $potential_id 

还要注意的是:

vtiger_crmentity - 这是其中一个条目是 加入核表所有实体类型记录。这存储了记录ID, 记录所有者ID,最后修改的用户ID,创建时间,修改时间 和说明的元信息。

2

表名是vtiger_inventoryproductrel

相关问题