如何制作有效的请求,例如:
UPDATE b2c SET tranche = '18 - 25'
WHERE (dateofbirth::date BETWEEN NOW()::date - 18 'year' AND NOW()::date - 25 'year')
感谢您的帮助
答案 0 :(得分:1)
dateofbirth::date BETWEEN
(NOW() - interval '25 year')::date AND
(NOW() - interval '18 year')::date
答案 1 :(得分:1)
您可以使用Postgres演员语法:
UPDATE b2c SET tranche = '18 - 25'
WHERE dateofbirth::date BETWEEN
NOW()::date - '25y'::interval AND
NOW()::date - '18y'::interval
答案 2 :(得分:1)