SELECT
  D.ID
FROM
  MS_GENERIC_CSV M
INNER JOIN
  MS_GENERIC_CSV_DTL D
ON
  D.DEFINE_NO = M.DEFINE_NO
  AND D.PHYSICAL_ITEM_NAME = /*:ItemName*/'item'
  AND D.VERSION > 0
WHERE
  M.DEFINE_NAME = /*:DefineName*/'name'
  AND M.VERSION > 0
