I have PostgreSQL table that look like this:
CREATE TABLE tb1 (
id integer,
name text,
date date,
time time without tz
);
With following query I am creating table with row_id's and time starting from 09:00 with increment every 10 minutes
(
SELECT g AS id, '09:00'::time + '10 min'::interval * (g-1) AS time
FROM generate_series (1,10) g
) g
left JOIN tb1 AS t1 USING (time)
After join I have new table which contain row's from table tb1 but only if time in tb1 have same time as one generated by '09:00'::time + '10 min'::interval * (g-1) AS time.
How to achieve that all rows with time from tb1 is "inserted" into generated table. If time generated is same than time from tb1 then no duplication should happen.