Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Select rows with no intersection on join table and check by date
--PostgreSQL 9.6 --'\\' is a delimiter create table source (created_at DATE, num INT, name VARCHAR(255)); create table filter (created_at DATE, num INT); insert into source (created_at, num, name) values ('2018-01-01', 1, '11'), ('2018-01-02', 2, '22'), ('2018-01-03', 3, '33'), ('2018-01-03', 9, '99'), ('2018-01-04', 4, '44'), ('2018-01-05', 5, '55'); insert into filter (created_at, num) values ('2018-01-01', 1), ('2018-01-02', 2), ('2018-01-03', 3), ('2018-01-04', 1), ('2018-01-05', 4), ('2018-01-05', 7); select * from source; select * from filter; select * from source left join filter on filter.num = source.num where filter.num IS NULL and source.created_at >= '2018-01-01' and source.created_at <= '2018-01-05' order by source.created_at asc ;
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Dashes in numbers
Q4_2
librarayv2
first
Movie Rating SQL Analysis Conducted by Miranda Zhao
HW1
PostgreSQL Sandbox: General Resale
SQL social network practice by Han Wang 20200720 - 2
Library Query
75 95
Please log in to post a comment.