Deleting Compliance reports and subscriptions via SQL

Hi, I’m looking for some help with exiting Compliance reports.

Some of the Compliance user’s have left and I would like to delete the Compliance reports they had saved.
Even though I’m Compliance admin, I don’t have the ability to delete those reports in the Compliance web portal (Delete button is greyed out when I click on any report which is not saved by me).

I am able to see all these reports in the SQL tables and able to see the report subscriptions as well.

I’m looking for a SQL query to delete these reports from the SQL table (delete selected reports base don the username).

Here is the query which shows all reports:
select * from dbo.reports subs
LEFT JOIN dbo.users u ON u.id=subs.user_id

Here is another query which shows all reports which has subscriptions:
select * from dbo.report_subscriptions subs
LEFT JOIN dbo.reports rep ON rep.id = subs.report_id
LEFT JOIN dbo.users u ON u.id=subs.user_id

Thanks

1 Like