-- Insert a tag if it got missed
--INSERT INTO tags_map (transaction_id, tag_id) VALUES(2247, 11);

-- Check your filter is correct first!
SELECT * FROM transactions t
	LEFT JOIN tags_map ON (transaction_id = t.id)
	LEFT JOIN tags tg ON (tag_id = tg.id)
	WHERE transaction_id = 2247;


-- Move from date to datej
--UPDATE public.transactions
--    -- Set the correct date on all rows that match the filter: Noon NZ time on 30 April 2024 (use exact time if known)
--    SET  ts=('2024-04-30 12:00'::timestamp with time zone AT TIME ZONE 'UTC')
--    -- Filter to the rows you want to alter: Noon NZ time on 15 April 2024 (use exact time if knwon)
--    WHERE ts::date = ('2024-04-15 12:00'::timestamp with time zone AT TIME ZONE 'UTC')::date;

-- Check your filter is correct first!
SELECT *, sum(price) OVER () FROM  public.transactions
WHERE ts::date = ('2024-04-15 12:00'::timestamp with time zone AT TIME ZONE 'UTC')::date and store_id = 8;
