Таблица subscriptions (id, user_id, created_at, updated_at)
Таблица subscription_stats (id, user_id, date)
Вывод без where:
select * from "subscriptions"
left join "subscription_stats"
on "subscriptions"."user_id" = "subscription_stats"."user_id"
limit 20
Как вывести список пользователей, у которых дата не равна заданной? Пробовал и <> и != ничего не выводит...
select * from "subscriptions"
left join "subscription_stats"
on "subscriptions"."user_id" = "subscription_stats"."user_id"
where "subscription_stats"."date" <> '2019-05-16'
Решение:
select "subscriptions"."user_id" from "subscriptions"
left join "subscription_stats"
on "subscriptions"."user_id" = "subscription_stats"."user_id"
where ("subscription_stats"."date" <> '2019-05-16' or ("subscription_stats"."date") is null)
limit 20