SELECT
  M.SCHEMA_NAME,
  M.REC_SQL,
  M.REC_WHERE,
  T.USER_PATTERN_NO,
  T.USER_PATTERN_NAME,
  T.DEFINE_NAME,
  T.HEADER,
  T.CONDITION_COLUMN,
  T.VERSION
FROM
  TR_GENERIC_CSV T
  INNER JOIN MS_GENERIC_CSV M
    ON T.DEFINE_NAME = M.DEFINE_NAME
    AND 0 < M.VERSION
WHERE
  T.ID = /*:Id*/0
  AND T.INSERT_ID = /*:Uid*/'nakayama'
  AND T.VERSION > 0
