Hi, I’m trying to understand what the difference i...
# suiteql
m
Hi, I’m trying to understand what the difference is between the
vendor
table and the
entity
table with
entity.type = 'Vendor'
. In particular, if we join the
entity
table to the
transaction
table, the we see that there are many expense transactions associated with entities that have type
Vendor
but where
transaction.vendor
is null.
s
From what I understand the
entity
table is for fields that are common for vendors and customers. The
vendor
table is for things that are specific for vendors. You need to join both, e.g.
Copy code
SELECT     transaction.id AS transaction_id,
               entity.externalid AS entity_externalid,
               entity.entitytitle AS entity_entitytitle,
               BUILTIN.DF(vendor.category) AS vendor_category_name
    FROM       transaction
    LEFT JOIN  entity ON (entity.id = transaction.entity)
    LEFT JOIN  vendor ON (vendor.id = transaction.entity)
    FETCH FIRST 5 ROWS ONLY