Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
MarcusHH
Engaged Sweeper

Hi All,

i found a report here in the Forum to catch 1 extension attribute were in my case i need a second extension attribute value as well. Any guidance would appreciated.

Thanks in advance

Marcus

1 ACCEPTED SOLUTION
Mister_Nobody
Honored Sweeper III

Try this:

Select Top 1000000 tblADusers.Userdomain,
  tblADusers.Username,
  tblADusers.EmployeeID,
  tblADusers.EmployeeType,
  tblADusers.FirstName,
  tblADusers.MiddleName,
  tblADusers.LastName,
  tblADusers.Company,
  tblADusers.IsEnabled,
  tblADusers.LastLogon,
  extension1.Value As ExtensionAttribute1,
  extension2.Value As ExtensionAttribute2,
  extension3.Value As ExtensionAttribute3,
  extension4.Value As ExtensionAttribute4,
  extension5.Value As ExtensionAttribute5,
  extension6.Value As ExtensionAttribute6,
  extension7.Value As ExtensionAttribute7,
  extension8.Value As ExtensionAttribute8,
  extension9.Value As ExtensionAttribute9,
  extension10.Value As ExtensionAttribute10,
  extension11.Value As ExtensionAttribute11,
  extension12.Value As ExtensionAttribute12,
  extension13.Value As ExtensionAttribute13,
  extension14.Value As ExtensionAttribute14,
  extension15.Value As ExtensionAttribute15
From tblADusers
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute1') As extension1 On
      extension1.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute2') As extension2 On
      extension2.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute3') As extension3 On
      extension3.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute4') As extension4 On
      extension4.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute5') As extension5 On
      extension5.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute6') As extension6 On
      extension6.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute7') As extension7 On
      extension7.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute8') As extension8 On
      extension8.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute9') As extension9 On
      extension9.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute10') As extension10 On
      extension10.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute11') As extension11 On
      extension11.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute12') As extension12 On
      extension12.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute13') As extension13 On
      extension13.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute14') As extension14 On
      extension14.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute15') As extension15 On
      extension15.AdObjectId = tblADusers.ADObjectID

View solution in original post

2 REPLIES 2
MarcusHH
Engaged Sweeper

Many thanks for the sample... that helps to adjust my reportings.

Mister_Nobody
Honored Sweeper III

Try this:

Select Top 1000000 tblADusers.Userdomain,
  tblADusers.Username,
  tblADusers.EmployeeID,
  tblADusers.EmployeeType,
  tblADusers.FirstName,
  tblADusers.MiddleName,
  tblADusers.LastName,
  tblADusers.Company,
  tblADusers.IsEnabled,
  tblADusers.LastLogon,
  extension1.Value As ExtensionAttribute1,
  extension2.Value As ExtensionAttribute2,
  extension3.Value As ExtensionAttribute3,
  extension4.Value As ExtensionAttribute4,
  extension5.Value As ExtensionAttribute5,
  extension6.Value As ExtensionAttribute6,
  extension7.Value As ExtensionAttribute7,
  extension8.Value As ExtensionAttribute8,
  extension9.Value As ExtensionAttribute9,
  extension10.Value As ExtensionAttribute10,
  extension11.Value As ExtensionAttribute11,
  extension12.Value As ExtensionAttribute12,
  extension13.Value As ExtensionAttribute13,
  extension14.Value As ExtensionAttribute14,
  extension15.Value As ExtensionAttribute15
From tblADusers
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute1') As extension1 On
      extension1.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute2') As extension2 On
      extension2.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute3') As extension3 On
      extension3.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute4') As extension4 On
      extension4.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute5') As extension5 On
      extension5.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute6') As extension6 On
      extension6.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute7') As extension7 On
      extension7.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute8') As extension8 On
      extension8.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute9') As extension9 On
      extension9.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute10') As extension10 On
      extension10.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute11') As extension11 On
      extension11.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute12') As extension12 On
      extension12.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute13') As extension13 On
      extension13.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute14') As extension14 On
      extension14.AdObjectId = tblADusers.ADObjectID
  Left Join (Select tblAdProperty.Value,
      tblAdProperty.AdObjectId
    From tblAdProperty
      Inner Join tsysAdPropertyType On tsysAdPropertyType.TypeId =
          tblAdProperty.TypeId
    Where tsysAdPropertyType.Name = 'ExtensionAttribute15') As extension15 On
      extension15.AdObjectId = tblADusers.ADObjectID

Reports & Analytics

Ask about reports you're interested in and share reports you've created. Subscribe to receive daily updates of reports shared in the Community.

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now