Query expression

Certified Associate Developer

I want to the same result as this SQL query "SELECT WorkType, COUNT(DISTINCT Site) AS DistinctSites FROM your_table_name GROUP BY WorkType;" in using query on data entity. I am able to get the count of sites and Group by WorkType but count of sites is not distinct.

a!queryEntity(
  entity: cons!SD_TEST_DATA,
  query: a!query(
    aggregation: a!queryAggregation(
      aggregationColumns: {
        a!queryAggregationColumn(
          field: "worktype",
          isGrouping: true
        ),
        a!queryAggregationColumn(
          field: "site",
          alias: "site_count",
          aggregationFunction: "COUNT"
        )
      }
    ),    
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: 50
    )
  ),
  fetchTotalCount: false
)

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data