SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table records ( user_id int, amount int, date date ); insert into records values (1, 10, '2021-05-01'), (1, 10, '2021-05-02'), (1, 10, '2021-05-03'); select date_trunc('month', to_date('2021-05-03', 'YYYY-MM-DD')); select sum(amount) from records where user_id = 1 and date_trunc('month', date) = date_trunc('month', to_date('2021-05-03', 'YYYY-MM-DD'));
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear