08-10-2016 05:12 PM
Select Top 1000000 tblAssets.AssetName,
tblAssets.Domain,
Cast(tblAssetCustom.Custom4 As datetime) As [Date Assigned],
tblAssetCustom.Serialnumber,
tblAssetCustom.Model,
tblAssets.AssetID,
tblAssets.Lastseen,
tblAssetCustom.Custom3 As Company,
tblAssetCustom.Custom1 As [Assigned Employee #],
tblADusers1.Displayname As [Assigned Employee],
tblAssetCustom.Custom2 As Assignment,
tblAssetCustom.Custom5 As Technician,
tblAssetCustom.Custom6 As PO,
tblAssetCustom.Lastchanged,
tblADusers.EmployeeNumber As [Last On Emp#],
tblADusers.Username As [Last On ID],
tblADusers.Displayname As [Last On Name]
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Left Join tblADusers On tblAssets.Username = tblADusers.Username
Left Join tblADusers tblADusers1 On tblAssetCustom.Custom1 =
tblADusers1.EmployeeNumber
Where (tblAssetCustom.Custom3 Like 'NoCo' And tblAssetCustom.Custom1 <> ''
And tblAssetCustom.State = 1) Or
(tblAssetCustom.Custom2 <> '') Or
(tblAssetCustom.Custom5 <> '')
Order By tblAssets.Domain,
[Date Assigned] Desc
AssetName | Domain | Date Assigned | Serialnumber | Model | Lastseen | Company | Assigned Employee # | Assigned Employee
DESKTOP68D01 | nasa | 01/01/2016 | a12bc32 | OptiPlex 790 | 07/25/2016 16:41:08 NoCo | 123456 | Doe, John
LAPTOP10D01 | nasa | 01/01/2016 | 324klnl | OptiPlex 7010 | 08/01/2016 15:16:14 NoCo | 45678 | Smith, Doc
LAPTOP10D01 | nasa | 01/01/2016 | 324klnl | OptiPlex 7010 | 08/01/2016 15:16:14 NoCo | 45678 | Smith, Doctor
Solved! Go to Solution.
08-12-2016 09:52 PM
Select Top 1000000 tblAssets.AssetName,
tblAssets.Domain,
Cast(tblAssetCustom.Custom4 As DATETIME) As [Date Assigned],
tblAssetCustom.Serialnumber,
tblAssetCustom.Model,
tblAssets.AssetID,
tblAssets.Lastseen,
tblAssetCustom.Custom3 As Company,
tblAssetCustom.Custom1 As [Assigned Employee #],
T1.Displayname As [Assigned Employee],
tblAssetCustom.Custom2 As Assignment,
tblAssetCustom.Custom5 As Technician,
tblAssetCustom.Custom6 As PO,
tblAssetCustom.Lastchanged,
tblADusers.EmployeeNumber As [Last On Emp#],
tblADusers.Username As [Last On ID],
tblADusers.Displayname As [Last On Name]
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Left Join tblADusers On tblAssets.Username = tblADusers.Username
Left Join (Select adu.EmployeeID,
Max(adu.Displayname) As Displayname
From tblADusers adu
Group By adu.EmployeeID) T1 On T1.EmployeeID = tblAssetCustom.Custom1
Where (tblAssetCustom.Custom3 Like 'NoCo' And tblAssetCustom.Custom1 <> '' And
tblAssetCustom.State = 1) Or
(tblAssetCustom.Custom2 <> '') Or
(tblAssetCustom.Custom5 <> '')
Order By tblAssets.Domain,
[Date Assigned] Desc
09-01-2016 08:04 PM
Select Top 1000000 tblAssets.AssetName,
tblAssets.Domain,
Cast(tblAssetCustom.Custom4 As DATETIME) As [Date Assigned],
tblAssetCustom.Serialnumber,
tblAssetCustom.Model,
tblAssets.AssetID,
tblAssets.Lastseen,
tblAssetCustom.Custom3 As Company,
tblAssetCustom.Custom1 As [Assigned Employee #],
T1.Displayname As [Assigned Employee],
tblAssetCustom.Custom2 As Assignment,
tblAssetCustom.Custom5 As Technician,
tblAssetCustom.Custom6 As PO,
tblAssetCustom.Lastchanged,
tblADusers.EmployeeNumber As [Last On Emp#],
tblADusers.Username As [Last On ID],
tblADusers.Displayname As [Last On Name]
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Left Join tblADusers On tblAssets.Username = tblADusers.Username
Left Join (Select adu.EmployeeID,
Max(adu.Displayname) As Displayname
From tblADusers adu
Group By adu.EmployeeID) T1 On T1.EmployeeID = tblAssetCustom.Custom1
Where tblAssetCustom.Custom3 Like 'NoCo' And tblAssetCustom.State = 1
Order By tblAssets.Domain,
[Date Assigned] Desc
09-01-2016 05:48 PM
08-30-2016 09:33 PM
08-30-2016 08:40 PM
08-30-2016 03:37 PM
08-12-2016 09:52 PM
Select Top 1000000 tblAssets.AssetName,
tblAssets.Domain,
Cast(tblAssetCustom.Custom4 As DATETIME) As [Date Assigned],
tblAssetCustom.Serialnumber,
tblAssetCustom.Model,
tblAssets.AssetID,
tblAssets.Lastseen,
tblAssetCustom.Custom3 As Company,
tblAssetCustom.Custom1 As [Assigned Employee #],
T1.Displayname As [Assigned Employee],
tblAssetCustom.Custom2 As Assignment,
tblAssetCustom.Custom5 As Technician,
tblAssetCustom.Custom6 As PO,
tblAssetCustom.Lastchanged,
tblADusers.EmployeeNumber As [Last On Emp#],
tblADusers.Username As [Last On ID],
tblADusers.Displayname As [Last On Name]
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Left Join tblADusers On tblAssets.Username = tblADusers.Username
Left Join (Select adu.EmployeeID,
Max(adu.Displayname) As Displayname
From tblADusers adu
Group By adu.EmployeeID) T1 On T1.EmployeeID = tblAssetCustom.Custom1
Where (tblAssetCustom.Custom3 Like 'NoCo' And tblAssetCustom.Custom1 <> '' And
tblAssetCustom.State = 1) Or
(tblAssetCustom.Custom2 <> '') Or
(tblAssetCustom.Custom5 <> '')
Order By tblAssets.Domain,
[Date Assigned] Desc
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now