{REPORT SQL DETAILS:SELECT TOP 1 e.[Id] FROM [Entities] e JOIN [EntityTypes] et on et.[Id]=e.[EntityTypeId] WHERE et.[Name]='Customers' ORDER BY e.[Id]:F.Id}
This pulls out Entity ID from the selected customer entity. It was a piece of code Q used in his Purchase History tutorial.