CR 10.0.5.820 For Sage
I have the following SQL Expression that doesn't work. The issue is with the last select statement which tries to pull the criteria from the main report ("timItem"."ItemID") table, which is the same table both of the nested queries are using. I've tried every permutation of the main report field, table aliases, CONVERT/CAST, etc. and the result is always blank. However, if I hard code the criteria (e.g. '24075') then it returns the correct value. Any help is greatly appreciated.
(SELECT timItem.ItemID
FROM timItem
INNER JOIN to2BOMLine ON to2BOMLine.ItemKey=timItem.ItemKey
INNER JOIN to2BOM ON to2BOMLine.BOMKey=to2BOM.BOMKey
WHERE timItem.ItemID LIKE 'BL%' AND to2BOM.BOMID IN
(SELECT timItem.ItemID
FROM timItem
INNER JOIN to2BOMLine ON to2BOMLine.ItemKey=timItem.ItemKey
INNER JOIN to2BOM ON to2BOMLine.BOMKey=to2BOM.BOMKey
WHERE BOMID = "timItem"."ItemID" AND timItem.ItemID LIKE 'CP%'))
Thanks.
I have the following SQL Expression that doesn't work. The issue is with the last select statement which tries to pull the criteria from the main report ("timItem"."ItemID") table, which is the same table both of the nested queries are using. I've tried every permutation of the main report field, table aliases, CONVERT/CAST, etc. and the result is always blank. However, if I hard code the criteria (e.g. '24075') then it returns the correct value. Any help is greatly appreciated.
(SELECT timItem.ItemID
FROM timItem
INNER JOIN to2BOMLine ON to2BOMLine.ItemKey=timItem.ItemKey
INNER JOIN to2BOM ON to2BOMLine.BOMKey=to2BOM.BOMKey
WHERE timItem.ItemID LIKE 'BL%' AND to2BOM.BOMID IN
(SELECT timItem.ItemID
FROM timItem
INNER JOIN to2BOMLine ON to2BOMLine.ItemKey=timItem.ItemKey
INNER JOIN to2BOM ON to2BOMLine.BOMKey=to2BOM.BOMKey
WHERE BOMID = "timItem"."ItemID" AND timItem.ItemID LIKE 'CP%'))
Thanks.