Mavzu: Microsoft Access dasturida hisobotlar yaratish. Reja


SELECT REP_OFFICE, MIN(QUOTA), MAX(QUOTA) FROM SALESREPS GROUP BY REP_OFFICE


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

SELECT REP_OFFICE, MIN(QUOTA), MAX(QUOTA)
FROM SALESREPS
GROUP BY REP_OFFICE
YAna bir so‗rov: Har bir ofisda qancha xizmatchi ishlaydi?
SELECT REP_OFFICE, COUNT(*)
FROM SALESREPS
GROUP BY REP_OFFICE
YAna bir guruhlanishli qiziqarli so‗rov: Har bir xizmatchi nechta mijozga xizmat
ko‗rsatadi?
SELECT COUNT(DISTINCT CUST_NUM), 'CUSTOMERS FOR SALESREPS',
CUST_REP
FROM CUSTOMERS
GROUP BY CUST_REP
Bu yerda 'CUSTOMERS FOR SALESREPS' psevdomaydonning ishlatilishiga
e‘tibor bering. So‗rov natijalarini bir nechta ustun bo‗yicha guruhlash mumkin.
Masalan, quyidagicha:
Har bir xizmatchi uchun har bir klient bo‗yicha buyurtmalar umumiy sonini
hisoblash.
SELECT REP, CUST, SUM(AMOUNT)
FROM ORDERS
GROUP BY REP, CUST
Lekin ikki ustun bo‗yicha guruhlashda natijalar ikki darajasiga ega guruhlar va
ostki guruhlar yaratish mumkin emas. Lekin tartiblashni qo‗llash mumkin. Shu
bilan birga GROUP BY ishlatilganda so‗rov natijalari avtomatik tartiblanadi.
Quyidagi so‗rovni ko‗ramiz: Har bir xizmatchi uchun har bir klient bo‗yicha
buyurtmalar umumiy sonini hisoblash; so‗rov natijalarini klientlar va xizmatchilar
bo‗yicha tartiblash.

Download 61.94 Kb.

Do'stlaringiz bilan baham:
1   ...   14   15   16   17   18   19   20   21   ...   27




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