I have an the following table fields:
Invitations (user_id, type, created_at, completed_at)
I'm currently able to obtain last week's invitation conversation rate by running the following query and manually computing.
SELECT *
FROM invitations
WHERE created_at >= curdate() - INTERVAL DAYOFWEEK(curdate())+6 DAY
AND created_at < curdate() - INTERVAL DAYOFWEEK(curdate())-1 DAY
AND user_id != 1
AND type = 'email'
ORDER BY completed_at, created_at
Is it possible with SQL to output more of a report... Something that returns:
LAST WEEK | Total Invitations | Invitations Completed | % Conversion
| 100 | 50 | 50%
TWO WEEKS | Total Invitations | Invitations Completed | % Conversion
| 100 | 60 | 60%
Is something like this possible with SQL or do I need to create this with application logic?