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