Answer the question
In order to leave comments, you need to log in
How to write a query to display data where the date is not equal to the given one?
subscriptions table (id, user_id, created_at, updated_at)
subscription_stats table (id, user_id, date)
Output without 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
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question