Skip to content
Advertisement

Getting empty result from a query

I have Client table

  • ClientGuid Email Phone

Also have Activity table

  • ActivityTitle Date ClientGuid

If client does some “Activity” it is saved in Activity table.

I want to get Emails of clients who did not have any activity in last three months and had activities before.

Tried this :

Getting empty result. What did I miss?

Advertisement

Answer

I don’t see why you would want a join — much less an outer join — in the subquery. This returns the emails of clients that have no activity in the past three months:

However, this also returns clients who have never had any activity at all. So, you seem to want:

If there are no activities, then the subquery returns NULL and the client is filtered out.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement