Aggregates: Duplicate Tables / Joins
254
Views
1
Comments
New
Aggregates & Queries

Service Studio: In the Aggregate editor, it may be useful to have a "duplicate" button for tables/ joins/ conditions, when performing multiple joins over the same table.


Ex.: 

SELECT *
  FROM Parent
  JOIN Child AS Child1 ON Child1.ParentId = Parent.Id
  JOIN Child AS Child2 ON Child2.ParentId = Parent.Id
 WHERE Parent.Id = @ParentId 
   AND Child1.IsActive = 1
   AND Child2.IsActive = 1
   AND Child1.Id <> Child2.Id


After adding "Child1" as a table + join condition on the parent, a "duplicate" button on the table would avoid:

  1. Selecting the same table for "Child2",
  2. Writing the same JOIN condition for "Child2",
  3. Writing the same WHERE condition for "Child2"
Changed the category to
Aggregates & Queries