Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT DISTINCT TOP 250
- Asset.AssetVersionId
- ,Asset.AssetSnapshotId
- ,Asset.AssetId
- ,Asset.Title
- ,Product.Title AS 'Model'
- ,Brand.Title AS 'Brand'
- ,Customer.Title AS 'Customer'
- ,Customer.CustomerId
- ,CustomerLocation.ServiceLocationId
- ,Asset.AssetSnapshotId
- ,ISNULL(AssetIdentifier_TagNumber.Value, '') AS 'TagNumber'
- ,CustomerLocation.Title AS 'CustomerLocation'
- ,Asset.TagLocationId
- ,ISNULL(TagLocation.TagLocationNumber, '') AS 'TagLocationTitle'
- ,TagLocation.RBIRequired
- ,Asset.AssetApprovalStatusId
- ,AssetManufacturerTag.SerialNumber
- ,Asset.FullModelNumber
- ,Customer.LocalTitle
- FROM
- dbo.vwAsset AS Asset
- INNER JOIN dbo.tblProduct AS Product ON Product.ProductId = Asset.ProductId
- INNER JOIN dbo.tblBrand AS Brand ON Brand.BrandId = Product.BrandId
- INNER JOIN dbo.tblCustomer AS Customer ON Customer.CustomerId = Asset.CustomerId
- INNER JOIN dbo.tblCustomerLocation AS CustomerLocation ON CustomerLocation.CustomerLocationId = Asset.CustomerLocationId
- INNER JOIN dbo.vwUserServiceLocation AS UserServiceLocation ON UserServiceLocation.ServiceLocationId = CustomerLocation.ServiceLocationId
- LEFT JOIN dbo.vwAssetIdentifier AS AssetIdentifier_TagNumber ON AssetIdentifier_TagNumber.AssetSnapshotId = Asset.AssetSnapshotId AND AssetIdentifier_TagNumber.Title = 'Tag Number'
- LEFT JOIN dbo.tblTagLocation AS TagLocation ON TagLocation.TagLocationId = Asset.TagLocationId
- INNER JOIN dbo.tblAssetManufacturerTag AS AssetManufacturerTag ON AssetManufacturerTag.AssetId = Asset.AssetId
- LEFT JOIN dbo.tblStatementOfWork AS SOW ON SOW.AssetId = Asset.AssetId
- LEFT JOIN dbo.tblWorkOrder AS WorkOrder ON WorkOrder.WorkOrderId = SOW.WorkOrderId
- LEFT JOIN dbo.tblProject AS Project ON Project.ProjectId = WorkOrder.ProjectId
- LEFT JOIN dbo.tblAssetIdentifierSnapshot AS AssetIdentifierSnapshot ON AssetIdentifierSnapshot.AssetSnapshotId = Asset.AssetSnapshotId
- LEFT JOIN dbo.tblAssetIdentifierVersion AS AssetIdentifierVersion ON AssetIdentifierVersion.AssetIdentifierVersionId = AssetIdentifierSnapshot.AssetIdentifierVersionId
- WHERE
- 1 = 1
- AND (Asset.Title LIKE '%E29%' OR AssetIdentifierVersion.Value LIKE '%E29%')
- AND UserServiceLocation.OwnerId = '1A07E201-D832-465D-A1B1-10500A20E16A'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement