Sql server® 2012 t-sql fundamentals


assigning Column aliases in CTes



Download 10,93 Mb.
Pdf ko'rish
bet217/443
Sana26.01.2022
Hajmi10,93 Mb.
#411755
1   ...   213   214   215   216   217   218   219   220   ...   443
Bog'liq
BookSQL

assigning Column aliases in CTes

CTEs also support two forms of column aliasing—inline and external. For the inline form, specify 



AS ; for the external form, specify the target column list in parentheses 

immediately after the CTE name.

Here’s an example of the inline form.

WITH C AS 

  SELECT YEAR(orderdate) AS orderyear, custid 



  FROM Sales.Orders 

SELECT orderyear, COUNT(DISTINCT custid) AS numcusts 



FROM C 

GROUP BY orderyear;

And here’s an example of the external form.

WITH C(orderyear, custid) AS 

  SELECT YEAR(orderdate), custid 



  FROM Sales.Orders 

SELECT orderyear, COUNT(DISTINCT custid) AS numcusts 



FROM C 

GROUP BY orderyear;

The motivations for using one form or the other are similar to those described in the context of 

derived tables.

www.it-ebooks.info




Download 10,93 Mb.

Do'stlaringiz bilan baham:
1   ...   213   214   215   216   217   218   219   220   ...   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