---
# System prepended metadata

title: SQL

---

# SQL
- SELECT TOP (1000) 
  sf.[id],
  sf.[standardFeeId]
  ,sf.[name]
  ,sf.[feeCategoriesId]
  ,sf.[calculationRulesId],
  fc.[d365CategoryId]
  FROM [finance].[StandardFee] sf
  inner join [finance].[FeeCategories] fc on fc.[feeCategoriesId] = sf.[feeCategoriesId] 
  where [standardFeeId] in ('D5912CEE-79FE-47D1-BB03-505FF42AC25A','1FA43EF7-F6AE-4FE7-BD21-70F957410179','E6D9ECC8-087D-48D0-8BDB-87C98390D7C7','0D820C6B-CC0F-4ADC-ADCC-8823ED835804','79FFFB0E-BCDB-4648-A25E-CC9A4964F2BF')
- SELECT TOP (1000) [id]
  ,[feeCategoryInWorkOrderTypeId]
  ,[workOrderTypeId]
  ,[feeCategoryCode]
  ,[isActive]
  FROM [finance].[feeCategoryInWorkOrderTypes]
  where [feeCategoryCode] in (SELECT
  fc.[d365CategoryId]
  FROM [finance].[StandardFee] sf
  inner join [finance].[FeeCategories] fc on fc.[feeCategoriesId] = sf.[feeCategoriesId] 
  where [standardFeeId] in ('D5912CEE-79FE-47D1-BB03-505FF42AC25A','1FA43EF7-F6AE-4FE7-BD21-70F957410179','E6D9ECC8-087D-48D0-8BDB-87C98390D7C7','0D820C6B-CC0F-4ADC-ADCC-8823ED835804','79FFFB0E-BCDB-4648-A25E-CC9A4964F2BF')
  )
- select * from finance.StandardFee where feeCategoriesId in (select feeCategoriesId from finance.FeeCategories where d365CategoryId in (select feeCategoryCode from finance.feeCategoryInWorkOrderTypes where workOrderTypeId = (SELECT workOrderTypeId from finance.workOrderTypes where workOrderTypeCode = 'BOOKINAUTO')))
- SELECT TOP (1000) [id]
  ,[feeCategoryInWorkOrderTypeId]
  ,[workOrderTypeId]
  ,[feeCategoryCode]
  ,[isActive]
  FROM [finance].[feeCategoryInWorkOrderTypes]
  where [feeCategoryCode] in (SELECT
  fc.[d365CategoryId]
  FROM [finance].[StandardFee] sf
  inner join [finance].[FeeCategories] fc on fc.[feeCategoriesId] = sf.[feeCategoriesId] 
  where [standardFeeId] in ('D5912CEE-79FE-47D1-BB03-505FF42AC25A','1FA43EF7-F6AE-4FE7-BD21-70F957410179','E6D9ECC8-087D-48D0-8BDB-87C98390D7C7','0D820C6B-CC0F-4ADC-ADCC-8823ED835804','79FFFB0E-BCDB-4648-A25E-CC9A4964F2BF')
  )
  
  
 ## KPow
 - .value.eventType == "AssetSaleAmended"
- .headers.correlationID[0] == "ffcb1c5f-b3de-46e4-ae5e-0c985f28dc30"