Friday, March 9, 2012

Help with query

SELECT Asset.AssetId, AssetType.Description, Asset.Barcode, AssetAttribute.AssetDescription, Asset.SKU, ESN.EsnNumber,
InventoryOrigin.WarehouseDescription, ESNTracking.TraceTime, ESNTracking.PreviousTraceTime, ESNTracking.HasMoved,
ESNTracking.DistanceMiles, ESNTracking.Direction, ESNTracking.Landmark, ESNTracking.FemaLocation,
ESNTracking.ReportTime, ESNTracking.ReplaceByDate, ESNTracking.CurrLocStreet, ESNTracking.CurrLocCity,
ESNTracking.CurrLocState, ESNTracking.CurrLocZip, ESNTracking.CurrLocCounty, ESNTracking.CurrMileFromStratix,
ESNTracking.PrevMileFromStratix
FROM AssetType INNER JOIN
Asset ON AssetType.AssetTypeId = Asset.AssetTypeId INNER JOIN
AssetAttribute ON AssetType.AssetTypeId = AssetAttribute.AssetTypeId AND
Asset.AssetAttributeId = AssetAttribute.AssetAttributeId INNER JOIN
AssetVehicle ON Asset.AssetId = AssetVehicle.AssetId INNER JOIN
AssetCustomAttribute ON Asset.AssetId = AssetCustomAttribute.AssetId INNER JOIN
AssetCustomAttributeDef ON AssetType.AssetTypeId = AssetCustomAttributeDef.AssetTypeId AND
AssetCustomAttribute.AssetCustomAttributeDefId = AssetCustomAttributeDef.AssetCustomAttributeDefId AND
AssetCustomAttribute.AssetTypeId = AssetCustomAttributeDef.AssetTypeId INNER JOIN
InventoryOrigin ON Asset.WarehouseId = InventoryOrigin.WarehouseId INNER JOIN
EsnAsset ON Asset.AssetId = EsnAsset.AssetId INNER JOIN
ESNTracking INNER JOIN
ESN ON ESNTracking.EsnId = ESN.EsnId ON EsnAsset.EsnId = ESN.EsnIdWhat kind of help do you need?|||

Here is my Where Statment, but it produces and error message and does not return any row.

WHERE B.AssetId = 'EsnNumber'
WHERE B.AssetId = 'J.EsnNumber'
WHERE B.AssetId = 'B.AssetID'
WHERE B.AssetId = 'I.EsnID'

|||

I still don't get it - what error message do you get?

also - you list 4 Where clauses, each of which are checking for an EXACT string - are you trying to use all of them, or any one of them? (assuming they are IDs you are checking - are they numeric or string?)

another thing - - you have B.AssetID in your Where clauses - where are you defining 'B'?

No comments:

Post a Comment