GraphQL distinct query help

System Information
  • Strapi Version: 3.4.6
  • Operating System:
  • Database: MariaDB 10.5
  • Node Version: v14.15.4
  • NPM Version:
  • Yarn Version:

Hello! I’m having difficulties figuring out how to solve the task of finding new unique entries within a single table.

A simplified example may be explained this way:

  • there is an activity / check-in table, containing 2 fields - date and email
  • I need to compare filtered activities for 2 dates (let’s say today and 1 week before) with a goal to list and get a number of new unique emails that were not logged in the activity table 1 week ago (on that specific date)

For each date there are about 700 emails.

The question is if this is doable with GraphQL / on strapi side. Alternatives - external middleware or SQL query on DB side are already under consideration.

And one additional question, if allowed - can I somehow just do a custom SQL query initiated by GraphQL call?

Thanks in advance!