Hi
I have a database for an E-commerce storefront. MSSQL 2008.
I have a table called Products and a table called Tags. This is a many to many relationship that is bound together by a table called ProductTags.
Products:
id, name, price
Tags:
id, name, sortorder, parentid(allow nulls)
ProductTags:
productid, tagid
I'm trying to create a View in SQL, but I just completely suck at writing SQL.
The View should consist of:
Tags.id, Tags.Name, Tags.sortorder, Tags.parentid, ProductCount, ChildTagCount
ProductCount is the number of products associated to this Tag. ChildTagCount is the number of Tags that has this Tag's id as its parentid.