Mavzu: Microsoft Access dasturida hisobotlar yaratish. Reja


SELECT EMPL_NUM, NAME, SUM(AMOUNT) FROM ORDERS, SALESREPS WHERE REP = EMPL_NUM GROUP BY EMPL_NUM, NAME


Download 61.94 Kb.
bet20/27
Sana30.11.2021
Hajmi61.94 Kb.
#178158
1   ...   16   17   18   19   20   21   22   23   ...   27
Bog'liq
2 5413458822343690664

SELECT EMPL_NUM, NAME, SUM(AMOUNT)
FROM ORDERS, SALESREPS
WHERE REP = EMPL_NUM
GROUP BY EMPL_NUM, NAME
Yana soddaroq shakl: Har bir xizmatchi uchun buyurtmalar umumiy sonini
hisoblash.
SELECT NAME, SUM(AMOUNT)
FROM ORDERS, SALESREPS
WHERE REP = EMPL_NUM
GROUP BY NAME
Agar guruhlash maydonlaridan birida NULL qiymat mavjud bo‗lsa qaysi guruhga
tegishli bo‗ladi? WHERE ifodasida NULL va NULL tenglikka solishtirish natijasi
yana NULL beradi. SHuning uchun ANSI/ISO standartida GROUP BY ifodasida
NULL qiymatlar teng deb qabul qilingan.
Guruhlash va HAVING yordamida ajratish
Shart bo‗yicha satrlarni ajratish uchun WHERE ifodasidan foydalangan
edik. Shart bo‗yicha guruhlarni ajratish uchun HAVING operatori mavjuddir.
Uning sintaksisi WHERE operatori bilan bir xil va ulardan birgalikda foydalanigsh
mumkin. Quyidagi so‗rovni ko‗ramiz:
Buyurtmalar umumiy narxi $300 dan ortiq xizmatchilar uchun buyurtma o‗rtacha
narxi qanchaga teng?

Download 61.94 Kb.

Do'stlaringiz bilan baham:
1   ...   16   17   18   19   20   21   22   23   ...   27




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