<?xml version="1.0" encoding="utf-8"?>
<PnPQueryDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <GroupBy>
     <string>PnPID</string> 
  </GroupBy>
  <OrderBy>
    <PnPSortItem>
      <SortDirection>Ascending</SortDirection>
      <SortColumn>PnID</SortColumn>
    </PnPSortItem>
  </OrderBy>
  <QuerySpecification xsi:type="PnPRelationshipQuerySpecification">
    <RightQuerySpecification xsi:type="PnPRelationshipQuerySpecification">
      <RightQuerySpecification xsi:type="PnPTableQuerySpecification">
        <Filter />
        <TableName>PipeLineGroup</TableName>
      </RightQuerySpecification>
      <LeftQuerySpecification xsi:type="PnPTableQuerySpecification">
        <Filter />
        <TableName>PipeLines</TableName>
      </LeftQuerySpecification>
      <RightRole>PipeLineGroup</RightRole>
      <LeftRole>PipeLine</LeftRole>
      <RelationshipTypes>
        <string>PipeLineGroupRelationship</string>
      </RelationshipTypes>
    </RightQuerySpecification>
    <LeftQuerySpecification xsi:type="PnPEqualJoinQuerySpecification">
      <RightQuerySpecification xsi:type="PnPEqualJoinQuerySpecification">
        <RightQuerySpecification xsi:type="PnPTableQuerySpecification">
          <Filter />
          <TableName>PnPDrawings</TableName>
        </RightQuerySpecification>
        <LeftQuerySpecification xsi:type="PnPTableQuerySpecification">
          <Filter />
          <TableName>PnPDataLinks</TableName>
        </LeftQuerySpecification>
        <RightJoinColumns>
          <string>PnPID</string>
        </RightJoinColumns>
        <LeftJoinColumns>
          <string>DwgId</string>
        </LeftJoinColumns>
        <JoinOperation>LeftOuter</JoinOperation>
      </RightQuerySpecification>
      <LeftQuerySpecification xsi:type="PnPTableQuerySpecification">
        <Filter />
        <TableName>PipingSpecialtyItems</TableName>
      </LeftQuerySpecification>
      <RightJoinColumns>
        <string>RowId</string>
      </RightJoinColumns>
      <LeftJoinColumns>
        <string>PnPID</string>
      </LeftJoinColumns>
      <JoinOperation>LeftOuter</JoinOperation>
    </LeftQuerySpecification>
    <RightRole>Line</RightRole>
    <LeftRole>Asset</LeftRole>
    <RelationshipTypes>
      <string>LineInLineAsset</string>
      <string>LineStartAsset</string>
      <string>LineEndAsset</string>
    </RelationshipTypes>
  </QuerySpecification>
  <SelectList>
    <string>Tag</string>
    <string>Size</string>
    <string>LineNumber</string>
    <string>Service</string>
    <string>PipeLines.Size</string>
    <string>Spec</string>
    <string>Insulation</string>
    <string>Manufacturer</string>
    <string>Description</string>
    <string>PnID</string>
    <string>Dwg Name</string>
    <string>PnPID</string>
  </SelectList>
</PnPQueryDefinition>