--- title: "GROUPING_ID (Transact-SQL) | Microsoft Docs" ms.custom: "" ms.date: "03/03/2017" ms.prod: "sql-non-specified" ms.reviewer: "" ms.suite: "" ms.technology: - "database-engine" ms.tgt_pltfrm: "" ms.topic: "language-reference" f1_keywords: - "GROUPING_ID_TSQL" - "GROUPING_ID" dev_langs: - "TSQL" helpviewer_keywords: - "GROUP BY clause, GROUPING_ID" - "GROUPING_ID function" ms.assetid: c1050658-b19f-42ee-9a05-ecd6a73b896c caps.latest.revision: 36 author: "BYHAM" ms.author: "rickbyh" manager: "jhubbard" --- # GROUPING_ID (Transact-SQL) [!INCLUDE[tsql-appliesto-ss2008-asdb-xxxx-xxx_md](../../includes/tsql-appliesto-ss2008-asdb-xxxx-xxx-md.md)] Is a function that computes the level of grouping. GROUPING_ID can be used only in the SELECT \