→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !
‎10-31-2013 05:18 PM
Solved! Go to Solution.
‎11-04-2013 09:15 PM
Select Top 1000000 Case
When tblAssetCustom.Model Like 'Latitude E6420%' Then
'Standard Laptop (Latitude E64xx)'
When tblAssetCustom.Model Like 'Latitude E6430%' Then
'Standard Laptop (Latitude E64xx)'
When tblAssetCustom.Model Like 'Latitude E6520%' Then
'Eng Laptop (Latitude E65xx)'
When tblAssetCustom.Model Like 'Latitude E6530%' Then
'Eng Laptop (Latitude E65xx)'
When tblAssetCustom.Model Like 'Optiplex 790%' Then
'Standard Desktop (Optiplex 7xxx)'
When tblAssetCustom.Model Like 'Optiplex 7010%' Then
'Standard Desktop (Optiplex 7xxx)'
When tblAssetCustom.Model Like 'Precision Workstation T3500%' Then
'Eng Desktop (Precision T3xxx)'
When tblAssetCustom.Model Like 'Precision Workstation T3600%' Then
'Eng Desktop (Precision T3xxx)' End As AssetClass,
Sum(Case When tblState.State = 9 Then 1 Else 0 End) As Stock,
Sum(Case When tblState.State = 7 Then 1 Else 0 End) As Spare
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblState On tblState.State = tblAssetCustom.State
Inner Join tblAssetGroupLink On tblAssets.AssetID = tblAssetGroupLink.AssetID
Inner Join tblAssetGroups On tblAssetGroups.AssetGroupID =
tblAssetGroupLink.AssetGroupID
Where tblAssets.Assettype = -1 And tblAssetGroups.AssetGroup = 'DLS' And
((tblAssetCustom.Model Like 'Latitude E6420%' And tblAssetGroups.AssetGroup =
'DLS') Or (tblAssetCustom.Model Like 'Latitude E6430%' And
tblAssetGroups.AssetGroup = 'DLS') Or (tblAssetCustom.Model Like
'Latitude E6520%' And tblAssetGroups.AssetGroup = 'DLS') Or
(tblAssetCustom.Model Like 'Latitude E6530%' And tblAssetGroups.AssetGroup =
'DLS') Or (tblAssetCustom.Model Like 'Optiplex 790%' And
tblAssetGroups.AssetGroup = 'DLS') Or (tblAssetCustom.Model Like
'Optiplex 7010%' And tblAssetGroups.AssetGroup = 'DLS') Or
(tblAssetCustom.Model Like 'Precision Workstation T3500%' And
tblAssetGroups.AssetGroup = 'DLS') Or (tblAssetCustom.Model Like
'Precision Workstation T3600%' And tblAssetGroups.AssetGroup = 'DLS'))
Group By Case
When tblAssetCustom.Model Like 'Latitude E6420%' Then
'Standard Laptop (Latitude E64xx)'
When tblAssetCustom.Model Like 'Latitude E6430%' Then
'Standard Laptop (Latitude E64xx)'
When tblAssetCustom.Model Like 'Latitude E6520%' Then
'Eng Laptop (Latitude E65xx)'
When tblAssetCustom.Model Like 'Latitude E6530%' Then
'Eng Laptop (Latitude E65xx)'
When tblAssetCustom.Model Like 'Optiplex 790%' Then
'Standard Desktop (Optiplex 7xxx)'
When tblAssetCustom.Model Like 'Optiplex 7010%' Then
'Standard Desktop (Optiplex 7xxx)'
When tblAssetCustom.Model Like 'Precision Workstation T3500%' Then
'Eng Desktop (Precision T3xxx)'
When tblAssetCustom.Model Like 'Precision Workstation T3600%' Then
'Eng Desktop (Precision T3xxx)' End,
tsysAssetTypes.AssetTypename
‎11-04-2013 11:28 PM
WHEN tblAssetCustom.Model LIKE 'Latitude E64%' THEN 'Standard Laptop (Latitude E64xx)'
WHEN tblAssetCustom.Model LIKE 'Latitude E65%' THEN 'Eng Laptop (Latitude E65xx)'
WHEN tblAssetCustom.Model LIKE 'Optiplex 7%' THEN 'Standard Desktop (Optiplex 7xxx)'
WHEN tblAssetCustom.Model LIKE 'Precision Workstation T3%' THEN 'Eng Desktop (Precision T3xxx)'
Where
tblAssets.Assettype = -1
And tblAssetGroups.AssetGroup = 'DLS'
And ( (tblAssetCustom.Model Like 'Latitude E6420%')
Or (tblAssetCustom.Model Like 'Latitude E6430%')
Or (tblAssetCustom.Model Like 'Latitude E6520%')
Or (tblAssetCustom.Model Like 'Latitude E6530%')
Or (tblAssetCustom.Model Like 'Optiplex 790%')
Or (tblAssetCustom.Model Like 'Optiplex 7010%')
Or (tblAssetCustom.Model Like 'Precision Workstation T3500%')
Or (tblAssetCustom.Model Like 'Precision Workstation T3600%')
)
‎11-04-2013 09:15 PM
Select Top 1000000 Case
When tblAssetCustom.Model Like 'Latitude E6420%' Then
'Standard Laptop (Latitude E64xx)'
When tblAssetCustom.Model Like 'Latitude E6430%' Then
'Standard Laptop (Latitude E64xx)'
When tblAssetCustom.Model Like 'Latitude E6520%' Then
'Eng Laptop (Latitude E65xx)'
When tblAssetCustom.Model Like 'Latitude E6530%' Then
'Eng Laptop (Latitude E65xx)'
When tblAssetCustom.Model Like 'Optiplex 790%' Then
'Standard Desktop (Optiplex 7xxx)'
When tblAssetCustom.Model Like 'Optiplex 7010%' Then
'Standard Desktop (Optiplex 7xxx)'
When tblAssetCustom.Model Like 'Precision Workstation T3500%' Then
'Eng Desktop (Precision T3xxx)'
When tblAssetCustom.Model Like 'Precision Workstation T3600%' Then
'Eng Desktop (Precision T3xxx)' End As AssetClass,
Sum(Case When tblState.State = 9 Then 1 Else 0 End) As Stock,
Sum(Case When tblState.State = 7 Then 1 Else 0 End) As Spare
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblState On tblState.State = tblAssetCustom.State
Inner Join tblAssetGroupLink On tblAssets.AssetID = tblAssetGroupLink.AssetID
Inner Join tblAssetGroups On tblAssetGroups.AssetGroupID =
tblAssetGroupLink.AssetGroupID
Where tblAssets.Assettype = -1 And tblAssetGroups.AssetGroup = 'DLS' And
((tblAssetCustom.Model Like 'Latitude E6420%' And tblAssetGroups.AssetGroup =
'DLS') Or (tblAssetCustom.Model Like 'Latitude E6430%' And
tblAssetGroups.AssetGroup = 'DLS') Or (tblAssetCustom.Model Like
'Latitude E6520%' And tblAssetGroups.AssetGroup = 'DLS') Or
(tblAssetCustom.Model Like 'Latitude E6530%' And tblAssetGroups.AssetGroup =
'DLS') Or (tblAssetCustom.Model Like 'Optiplex 790%' And
tblAssetGroups.AssetGroup = 'DLS') Or (tblAssetCustom.Model Like
'Optiplex 7010%' And tblAssetGroups.AssetGroup = 'DLS') Or
(tblAssetCustom.Model Like 'Precision Workstation T3500%' And
tblAssetGroups.AssetGroup = 'DLS') Or (tblAssetCustom.Model Like
'Precision Workstation T3600%' And tblAssetGroups.AssetGroup = 'DLS'))
Group By Case
When tblAssetCustom.Model Like 'Latitude E6420%' Then
'Standard Laptop (Latitude E64xx)'
When tblAssetCustom.Model Like 'Latitude E6430%' Then
'Standard Laptop (Latitude E64xx)'
When tblAssetCustom.Model Like 'Latitude E6520%' Then
'Eng Laptop (Latitude E65xx)'
When tblAssetCustom.Model Like 'Latitude E6530%' Then
'Eng Laptop (Latitude E65xx)'
When tblAssetCustom.Model Like 'Optiplex 790%' Then
'Standard Desktop (Optiplex 7xxx)'
When tblAssetCustom.Model Like 'Optiplex 7010%' Then
'Standard Desktop (Optiplex 7xxx)'
When tblAssetCustom.Model Like 'Precision Workstation T3500%' Then
'Eng Desktop (Precision T3xxx)'
When tblAssetCustom.Model Like 'Precision Workstation T3600%' Then
'Eng Desktop (Precision T3xxx)' End,
tsysAssetTypes.AssetTypename
‎11-04-2013 07:48 PM
SELECT Top 1000000
CASE
WHEN tblAssetCustom.Model LIKE 'Latitude E6420%' THEN 'notebook class 1'
WHEN tblAssetCustom.Model LIKE 'Latitude E6430%' THEN 'notebook class 1'
WHEN tblAssetCustom.Model LIKE 'Latitude E6520%' THEN 'notebook class 2'
WHEN tblAssetCustom.Model LIKE 'Latitude E6530%' THEN 'notebook class 2'
WHEN tblAssetCustom.Model LIKE 'Optiplex 790%' THEN 'desktop class 1'
WHEN tblAssetCustom.Model LIKE 'Optiplex 7010%' THEN 'desktop class 1'
WHEN tblAssetCustom.Model LIKE 'Precision Workstation T3500%' THEN 'desktop class 2'
WHEN tblAssetCustom.Model LIKE 'Precision Workstation T3600%' THEN 'desktop class 2'
END AS AssetClass,
Sum(CASE WHEN tblState.State = 9 THEN 1 ELSE 0 END) AS Stock,
Sum(CASE WHEN tblState.State = 7 THEN 1 ELSE 0 END) AS Spare
FROM
tblAssets
INNER JOIN tblAssetCustom ON tblAssets.AssetID = tblAssetCustom.AssetID
INNER JOIN tsysAssetTypes ON tsysAssetTypes.AssetType = tblAssets.Assettype
INNER JOIN tblState ON tblState.State = tblAssetCustom.State
INNER JOIN tblAssetGroupLink ON tblAssets.AssetID = tblAssetGroupLink.AssetID
INNER JOIN tblAssetGroups ON tblAssetGroups.AssetGroupID = tblAssetGroupLink.AssetGroupID
WHERE
tblAssets.Assettype = -1
AND tblAssetGroups.AssetGroup = 'DLS'
AND ( (tblAssetCustom.Model LIKE 'Latitude E6420%')
OR (tblAssetCustom.Model LIKE 'Latitude E6430%')
OR (tblAssetCustom.Model LIKE 'Latitude E6520%')
OR (tblAssetCustom.Model LIKE 'Latitude E6530%')
OR (tblAssetCustom.Model LIKE 'Optiplex 790%')
OR (tblAssetCustom.Model LIKE 'Optiplex 7010%')
OR (tblAssetCustom.Model LIKE 'Precision Workstation T3500%')
OR (tblAssetCustom.Model LIKE 'Precision Workstation T3600%')
)
GROUP BY
CASE
WHEN tblAssetCustom.Model LIKE 'Latitude E6420%' THEN 'notebook class 1'
WHEN tblAssetCustom.Model LIKE 'Latitude E6430%' THEN 'notebook class 1'
WHEN tblAssetCustom.Model LIKE 'Latitude E6520%' THEN 'notebook class 2'
WHEN tblAssetCustom.Model LIKE 'Latitude E6530%' THEN 'notebook class 2'
WHEN tblAssetCustom.Model LIKE 'Optiplex 790%' THEN 'desktop class 1'
WHEN tblAssetCustom.Model LIKE 'Optiplex 7010%' THEN 'desktop class 1'
WHEN tblAssetCustom.Model LIKE 'Precision Workstation T3500%' THEN 'desktop class 2'
WHEN tblAssetCustom.Model LIKE 'Precision Workstation T3600%' THEN 'desktop class 2'
END,
tsysAssetTypes.AssetTypename
‎11-04-2013 07:41 PM
‎11-04-2013 07:40 PM
SELECT Top 1000000
CASE
WHEN tblPortableBattery.AssetID IS NULL
THEN 'standard desktop'
ELSE 'standard laptop'
END AS AssetClass,
Sum(CASE WHEN tblState.State = 9 THEN 1 ELSE 0 END) AS Stock,
Sum(CASE WHEN tblState.State = 7 THEN 1 ELSE 0 END) AS Spare
FROM
tblAssets
INNER JOIN tblAssetCustom ON tblAssets.AssetID = tblAssetCustom.AssetID
INNER JOIN tsysAssetTypes ON tsysAssetTypes.AssetType = tblAssets.Assettype
INNER JOIN tblState ON tblState.State = tblAssetCustom.State
INNER JOIN tblAssetGroupLink ON tblAssets.AssetID = tblAssetGroupLink.AssetID
INNER JOIN tblAssetGroups ON tblAssetGroups.AssetGroupID = tblAssetGroupLink.AssetGroupID
LEFT JOIN tblPortableBattery ON tblPortableBattery.AssetID = tblAssets.AssetID
WHERE
tblAssets.Assettype = -1
AND tblAssetGroups.AssetGroup = 'DLS'
AND ( (tblAssetCustom.Model LIKE 'Latitude E6420%')
OR (tblAssetCustom.Model LIKE 'Latitude E6430%')
OR (tblAssetCustom.Model LIKE 'Latitude E6520%')
OR (tblAssetCustom.Model LIKE 'Latitude E6530%')
OR (tblAssetCustom.Model LIKE 'Optiplex 790%')
OR (tblAssetCustom.Model LIKE 'Optiplex 7010%')
OR (tblAssetCustom.Model LIKE 'Precision Workstation T3500%')
OR (tblAssetCustom.Model LIKE 'Precision Workstation T3600%')
)
GROUP BY
CASE
WHEN tblPortableBattery.AssetID IS NULL
THEN 'standard desktop'
ELSE 'standard laptop'
END,
tsysAssetTypes.AssetTypename
‎11-04-2013 05:16 PM
Select Top 1000000 Coalesce(tblAssetCustom.Model, N'Unknown') As AssetModel,
Sum(Case When tblState.State = 9 Then 1 Else 0 End) As Stock,
Sum(Case When tblState.State = 7 Then 1 Else 0 End) As Spare
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblState On tblState.State = tblAssetCustom.State
Inner Join tblAssetGroupLink On tblAssets.AssetID = tblAssetGroupLink.AssetID
Inner Join tblAssetGroups On tblAssetGroups.AssetGroupID =
tblAssetGroupLink.AssetGroupID
Where (tblAssets.Assettype = -1 And Coalesce(tblAssetCustom.Model,
N'Unknown') Like 'Latitude E6420%' And tblAssetGroups.AssetGroup = 'DLS') Or
(Coalesce(tblAssetCustom.Model, N'Unknown') Like 'Latitude E6430%' And
tblAssetGroups.AssetGroup = 'DLS') Or
(Coalesce(tblAssetCustom.Model, N'Unknown') Like 'Latitude E6520%' And
tblAssetGroups.AssetGroup = 'DLS') Or
(Coalesce(tblAssetCustom.Model, N'Unknown') Like 'Latitude E6530%' And
tblAssetGroups.AssetGroup = 'DLS') Or
(Coalesce(tblAssetCustom.Model, N'Unknown') Like 'Optiplex 790%' And
tblAssetGroups.AssetGroup = 'DLS') Or
(Coalesce(tblAssetCustom.Model, N'Unknown') Like 'Optiplex 7010%' And
tblAssetGroups.AssetGroup = 'DLS') Or
(Coalesce(tblAssetCustom.Model, N'Unknown') Like
'Precision Workstation T3500%' And tblAssetGroups.AssetGroup = 'DLS') Or
(Coalesce(tblAssetCustom.Model, N'Unknown') Like
'Precision Workstation T3600%' And tblAssetGroups.AssetGroup = 'DLS')
Group By Coalesce(tblAssetCustom.Model, N'Unknown'),
Coalesce(tblAssetCustom.Manufacturer, N'Unknown'),
tsysAssetTypes.AssetTypename
‎11-01-2013 06:59 PM
WHERE
tblAssets.Assettype = -1
AND tblAssetCustom.Manufacturer LIKE 'Dell%'
WHERE
tblAssets.Assettype = -1
AND tblAssetCustom.Model LIKE 'Latitude%'
WHERE
tblAssets.Assettype = -1
AND ( tblAssetCustom.Model LIKE 'Latitude%'
OR tblAssetCustom.Model LIKE 'Precision%'
)
IF <field> IS NOT NULL
THEN <field>
ELSE <alt-text>
IF tblAssetCustom.Model IS NOT NULL
THEN tblAssetCustom.Model
ELSE 'Unknown'
‎11-01-2013 06:57 PM
‎11-01-2013 05:59 PM
WHERE
tblAssets.Assettype = -1
AND Coalesce(tblAssetCustom.Manufacturer, N'Unknown') LIKE 'Dell%'
WHERE
tblAssets.Assettype = -1
AND Coalesce(tblAssetCustom.Model, N'Unknown') LIKE 'Latitude%'
WHERE
tblAssets.Assettype = -1
AND ( Coalesce(tblAssetCustom.Model, N'Unknown') LIKE 'Latitude%'
OR Coalesce(tblAssetCustom.Model, N'Unknown') LIKE 'Precision%'
)
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now