First, I modified the query just a bit, because
a) I put in comments that indicate what each clause is doing
b) The original poster mentioned "and no orders", but I don't see that they checked that explicitly. Maybe they assumed if the customer did not have an Address, but I just want to be sure. (e.g. free digital order??)
c) I added a clause where you can adjust the number of days ago (old). Because you may want to allow for a recent registered customer to come back within a couple of days.
I made it "2", but you can change to "0" if you like
d) also added IP Address and DaysAgo to the SELECT
SELECT c.[Id],[Username],[Email],c.[CreatedOnUtc],[LastLoginDateUtc],[LastActivityDateUtc]
, c.LastIpAddress
, datediff(day, c.CreatedOnUtc, GetDate()) as DaysAgo
FROM [Customer] as c
join Customer_CustomerRole_Mapping as crm on c.id=crm.Customer_Id
left join ShoppingCartItem as sc on c.id=sc.CustomerId
left join CustomerAddresses as ca on c.id=ca.Customer_Id
left join [Order] as o on c.id=o.CustomerId
where CustomerRole_Id =3 --registered
and c.deleted=0 --not deleted
and ca.Address_Id is null --no addresses
and sc.CustomerId is null --no shopping cart items
and o.CustomerId is null --no orders
and datediff(day, c.CreatedOnUtc, LastActivityDateUtc) = 0 --last activity was on same day as create
and datediff(day, c.CreatedOnUtc, GetDate()) > 2 --how many days ago that they were created
order by c.Id, LastLoginDateUtc, LastActivityDateUtc
So, to make that a a DELETE, change SELECT to "DELETE Customer", and remove the "order by" clause:
DELETE Customer
FROM [Customer] as c
join Customer_CustomerRole_Mapping as crm on c.id=crm.Customer_Id
left join ShoppingCartItem as sc on c.id=sc.CustomerId
left join CustomerAddresses as ca on c.id=ca.Customer_Id
left join [Order] as o on c.id=o.CustomerId
where CustomerRole_Id =3 --registered
and c.deleted=0 --not deleted
and ca.Address_Id is null --no addresses
and sc.CustomerId is null --no shopping cart items
and o.CustomerId is null --no orders
and datediff(day, c.CreatedOnUtc, LastActivityDateUtc) = 0 --last activity was on same day as create
and datediff(day, c.CreatedOnUtc, GetDate()) > 2 --how many days ago that they were created