MySQLにSQLクエリがあります:
SELECT
distinct
us.user_id as user_id,
us.ab_id,
users.name,
users.role,
users.is_admin,
DATE_FORMAT('2013-11-05T10:06:21+04:00', '%Y-%m') as month_m
FROM attach_offices as us
LEFT JOIN users ON users.id = user_id
WHERE us.`ab_id` = 999999999 and
DATE_FORMAT('2013-11-05T10:06:21+04:00', '%Y-%m') between DATE_FORMAT(dt_begin, '%Y-%m') and DATE_FORMAT(`dt_end`, '%Y-%m')
それを Oracle 11g に変換するにはどうすればよいですか? 私はこのようなものを書きます:
SELECT
distinct
attach_offices.user_id as user_id,
attach_offices.ab_id,
users.name,
users.role,
users.is_admin,
to_date('2013-11-05T10:06:21+04:00', 'YYYY-MM') as month_m
FROM attach_offices
LEFT JOIN users ON users.id = user_id
WHERE attach_offices.ab_id = 999999999 and
to_date('2013-11-05T10:06:21+04:00', 'YYYY-MM') between to_date(to_char(dt_begin, 'YYYY-MM'), 'YYYY-MM') and to_date(to_char(dt_end, 'YYYY-MM'), 'YYYY-MM')
しかし、うまくいきません。日付の問題、使用する2013-11-05T10:06:21+04:00
と機能しませんが、使用2013-11
すると機能します