---
title: "Discussion on \"Custom Aggregate Function (to use with GROUP BY)\" | Hashnode"
description: "Discussion on \"Custom Aggregate Function (to use with GROUP BY)\". Question:\nI'm wondering if it's possible to create a custom SQL group by function.\nFor example, I often need to find the most common value within a group. While I can achieve this using CTEs or subqueries, having a custom group by function like the e..."
url: "https://hashnode.com/posts/custom-aggregate-function-to-use-with-group-by/686fbfc9661b2396379371e5"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Custom Aggregate Function (to use with GROUP BY)](https://databasedev.hashnode.dev/custom-aggregate-function-to-use-with-group-by?utm_source=hashnode&utm_medium=feed)

Question: I'm wondering if it's possible to create a custom SQL group by function. For example, I often need to find the most common value within a group. While I can achieve this using CTEs or subqueries, having a custom group by function like the e...

Jul 10, 2025 · 2 min read · databasedev.hashnode.dev  
Read the article

-   [#sql](https://hashnode.com/tag/sql)
-   [#sql-server](https://hashnode.com/tag/sql-server)
-   [#group-by](https://hashnode.com/tag/group-by)
-   [#databases](https://hashnode.com/tag/databases)
-   [#qanda](https://hashnode.com/tag/qanda)

## Written by

[Gabriella Barajas](https://hashnode.com/@gabbbybar)

@gabbbybar · USA

  
[View profile](https://hashnode.com/@gabbbybar)

Real Questions. Clean Answers. All About Databases.

A database Q&amp;A blog for those who’d rather debug queries than read documentation. Practical answers to real questions — mostly SQL Server and MySQL, with a pinch of sarcasm and a love for clean code.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
