Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > How to join two custom tables. View modes: 
User avatar
Member
Member
BC - 10/13/2009 7:07:14 PM
   
How to join two custom tables.
Traditional I would use a JOIN statement to connect two tables together. I’m trying to figure out how to join two tables using custom tables. Let’s say for example I have two table’s contacts and phone numbers with the following structure.

Contacts (contact Id, first name, last name)
PhoneNumbers (phone Id, contact id, Phone type, phone number)

Traditionally I would have created a sql statement like

SELECT * FROM Contacts
JOIN PhoneNumbers ON Contacts.contactid = PhoneNumbers.ContactId

How do I do something similar with custom tables?

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 10/20/2009 9:09:42 AM
   
RE:How to join two custom tables.
Hello,

you can optionally write custom query with join and then use ExecuteQuery method to get DataSet with results. Please see 'Running a custom query' section at Code examples for more details and example.

Best Regards,

Martin Dobsicek