Delete statement conflicted with the reference constraint "fkey$md_query_condition$qa". The conflict occurred in database "[DATABASE NAME]", table "dbo.md_query_condition", column "md_query_attribute_guid". The statement has been terminated.
If you create a query with at least one condition and then copy that query the child query will reference this condition preventing the original from being deleted.
Solution / Workaround:
In order to resolve this issue you will need to delete any query created as a child and any sub-children queries that were created. Once you have done that the reference constraint will be lifted and the original query can be deleted.