SELECT
    (
        SELECT
            Measurement.PointID AS tsfId,
            Device.Acronym AS tsfSource,
            CONVERT(INT, RIGHT(Measurement.PointTag, PATINDEX('%[^0-9]%', REVERSE(Measurement.PointTag)) - 1)) - 1 AS dnpIndex
        FROM
            Measurement JOIN
            Device ON Measurement.DeviceID = Device.ID JOIN
            Device Parent ON Device.ParentID = Parent.ID
        WHERE
            Parent.Acronym = 'DOUGLASVILLE' AND
            Measurement.PointTag LIKE '%:AV%'
        ORDER BY Measurement.PointID
        FOR XML PATH('Mapping'), TYPE
    ) analogMap,
    (
        SELECT
            Measurement.PointID AS tsfId,
            Device.Acronym AS tsfSource,
            CONVERT(INT, RIGHT(Measurement.PointTag, PATINDEX('%[^0-9]%', REVERSE(Measurement.PointTag)) - 1)) - 1 AS dnpIndex
        FROM
            Measurement JOIN
            Device ON Measurement.DeviceID = Device.ID JOIN
            Device Parent ON Device.ParentID = Parent.ID
        WHERE
            Parent.Acronym = 'DOUGLASVILLE' AND
            Measurement.PointTag LIKE '%:DV%'
        ORDER BY Measurement.PointID
        FOR XML PATH('Mapping'), TYPE
    ) binaryMap
FOR XML PATH(''), TYPE