Optimove interview question

Write an sql query with join