Developer forum

Forum » Ecommerce - Standard features » SQL - Select ProductGroups that hava certain ProductGroup parent/s

SQL - Select ProductGroups that hava certain ProductGroup parent/s

Hans Ravnsfjall
Hans Ravnsfjall
Reply

Trying to figure out the relation between EcomProductGroups in the database, with no luck.

Anyone got a suggestion on how i can select EcomProductGroups with certain - defined parentgroups via. SQL?

/Hans


Replies

 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply
This post has been marked as an answer

Hi Hans,

The groups relate to themselves through EcomGroupRelations (recursively, as needed).

Here's a query that relates a group to its parent:

 SELECT child.GroupID ChildGroupID, child.GroupName ChildGroupName, parent.GroupID ParentGroupID, parent.GroupName ParentGroupName FROM EcomGroups child
JOIN EcomGroupRelations r ON child.GroupID = r.GroupRelationsGroupID
JOIN EcomGroups parent ON parent.GroupID = r.GroupRelationsParentID
 
Scott
Votes for this answer: 1
 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Brilliant Scott 👍🏻

thank you ever so much 🙏

 

/Hans

 

You must be logged in to post in the forum