Sql server® 2012 t-sql fundamentals



Download 10,93 Mb.
Pdf ko'rish
bet281/443
Sana26.01.2022
Hajmi10,93 Mb.
#411755
1   ...   277   278   279   280   281   282   283   284   ...   443
Bog'liq
BookSQL

Grouping Sets

This section describes both what grouping sets are and the features in SQL Server that support 

grouping sets.

A grouping set is simply a set of attributes by which you group. Traditionally in SQL, a single ag-

gregate query defines a single grouping set. For example, each of the following four queries defines 

a single grouping set.

SELECT empid, custid, SUM(qty) AS sumqty 

FROM dbo.Orders 

GROUP BY empid, custid; 

 

SELECT empid, SUM(qty) AS sumqty 



FROM dbo.Orders 

GROUP BY empid; 

 

SELECT custid, SUM(qty) AS sumqty 



FROM dbo.Orders 

GROUP BY custid; 

 

SELECT SUM(qty) AS sumqty 



FROM dbo.Orders;

The first query defines the grouping set (empid, custid); the second (empid), the third (custid), and 

the last query define what’s known as the empty grouping set, (). This code returns four result sets—

one for each of the four queries.

www.it-ebooks.info




Download 10,93 Mb.

Do'stlaringiz bilan baham:
1   ...   277   278   279   280   281   282   283   284   ...   443




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish