al3xicon
10/20/2023, 1:19 PMcustomer
table to the contact
table - but without using the company
field on the contact record, as that field only contains a single entity reference, whereas a contact may be associated to multiple entities. The contactList
field on the customer
table returns a text field which is a comma-separated list of contact
IDs - I've tried subqueries to no avail with it. E.g. this works:
SELECT cu.id, cu.contactlist from customer as cu, contact as co WHERE cu.id = 140 and co.id in (11,1144)
(11 and 1144 are the two IDs returned from contactList
for customer 140, but this does not:
SELECT cu.id, cu.contactlist from customer as cu, contact as co WHERE cu.id = 140 and co.id in (cu.contactlist)
("Search error occurred: Invalid or unsupported search")tdietrich
10/20/2023, 2:16 PMtdietrich
10/20/2023, 2:17 PMSELECT TOP 100
Entity.ID AS Entity,
Entity.EntityId,
Contact.ID AS Contact,
Contact.LastName,
Contact.FirstName
FROM
COMPANYCompanyContact AS CompanyContacts
INNER JOIN Entity ON
( Entity.ID = CompanyContacts.ContactsCompany )
INNER JOIN Contact ON
( Contact.ID = CompanyContacts.Contact )
ORDER BY
Entity.EntityId,
Contact.LastName,
Contact.FirstName
tdietrich
10/20/2023, 2:17 PMal3xicon
10/20/2023, 2:22 PMraghav
10/20/2023, 2:23 PMal3xicon
10/20/2023, 2:25 PMtdietrich
10/20/2023, 2:25 PMtdietrich
10/20/2023, 2:25 PMtdietrich
10/20/2023, 2:29 PMraghav
10/20/2023, 2:49 PMtdietrich
10/20/2023, 2:50 PM