Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.sqlserver.programming > #31385

Days of Week with Total

X-Received by 2002:a05:600c:2258:b0:405:514d:eb0d with SMTP id a24-20020a05600c225800b00405514deb0dmr255675wmm.4.1697098245536; Thu, 12 Oct 2023 01:10:45 -0700 (PDT)
X-Received by 2002:a05:6808:654b:b0:3af:c707:8c9b with SMTP id fn11-20020a056808654b00b003afc7078c9bmr7813047oib.4.1697098244800; Thu, 12 Oct 2023 01:10:44 -0700 (PDT)
Path csiph.com!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.128.87.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups microsoft.public.sqlserver.programming
Date Thu, 12 Oct 2023 01:10:44 -0700 (PDT)
Injection-Info google-groups.googlegroups.com; posting-host=50.39.159.56; posting-account=3EeGMgoAAAANuVqrAfuxBH48dyu1rSL_
NNTP-Posting-Host 50.39.159.56
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <f2e353a4-d330-48a3-ab37-0c77f77f617an@googlegroups.com> (permalink)
Subject Days of Week with Total
From Russ Hromyko <rhromyko@gmail.com>
Injection-Date Thu, 12 Oct 2023 08:10:45 +0000
Content-Type text/plain; charset="UTF-8"
Xref csiph.com microsoft.public.sqlserver.programming:31385

Show key headers only | View raw


Here is my query:

(SELECT DayName(startdate), COUNT(1) 
FROM reservations 
WHERE MONTH(startdate) = 09 AND YEAR(startdate) = 2023
GROUP BY DayName(startdate)
ORDER BY DAYOFWEEK(startdate))
UNION ALL
SELECT 'Total' widgets, COUNT(1)
FROM reservations

The output is:

Friday		14
Saturday	6
Sunday		3
Thursday	6
Tuesday		1
Monday		5
Wednesday	2
Total		37

How do I make the output Sunday through Saturday with Total?

Sunday		3
Monday		5
Tuesday		1
Wednesday	2
Thursday	6
Friday		14
Saturday	6
Total		37

Back to microsoft.public.sqlserver.programming | Previous | Next | Find similar


Thread

Days of Week with Total Russ Hromyko <rhromyko@gmail.com> - 2023-10-12 01:10 -0700

csiph-web