From: | Anthony Apollis <anthony(dot)apollis(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Calendar Table |
Date: | 2024-07-10 15:38:12 |
Message-ID: | CAJyMCYJAKCB+RTKxddG=hAbyFLQvTF2BuHhfwWvmhb4MTTB3pA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I have a Calendar table that need to be displaying Fiscal Start and End
Date as in below:
[image: f1]
The Calendar is currently have data for years 2023 - 2028:
-- Query to get the year and number of days
SELECT
EXTRACT(YEAR FROM "Date") AS "Year",
COUNT(*) AS "NumberOfDays"
FROM "Prod"."IMETA_Calendar"
GROUP BY EXTRACT(YEAR FROM "Date")
ORDER BY EXTRACT(YEAR FROM "Date");
--
[image: f5]
When i run code:
-- Query to get the year and number of days
SELECT
EXTRACT(YEAR FROM "Date") AS "Year",
COUNT(*) AS "NumberOfDays"
FROM "Prod"."IMETA_Calendar"
GROUP BY EXTRACT(YEAR FROM "Date")
ORDER BY EXTRACT(YEAR FROM "Date");
-- Table creation script
CREATE TABLE "Prod"."IMETA_Calendar" (
"Date" timestamp NOT NULL,
"FY" varchar(255),
"Period" varchar(255),
"Quarter" varchar(255),
"Day" int NOT NULL,
"Month" int NOT NULL,
"Year" int NOT NULL,
"Loaddate" timestamp NOT NULL
);
I get some output: [image: f6]
For any other Period and Year i get no results. What is wrong with my
Calendar table. Attached is the Calendar Table Data.
CREATE TABLE [Prod].[IMETA_Calendar](
[Date] [datetime] NOT NULL,
[FY] [nvarchar](255) NULL,
[Period] [nvarchar](255) NULL,
[Quarter] [nvarchar](255) NULL,
[Day] [int] NOT NULL,
[Month] [int] NOT NULL,
[Year] [int] NOT NULL,
[Loaddate] [datetime] NOT NULL
) ON [PRIMARY]
Attachment | Content-Type | Size |
---|---|---|
Book1.xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | 89.6 KB |
![]() |
image/png | 28.2 KB |
f2.png | image/png | 129.9 KB |
f1.png | image/png | 95.9 KB |
f3.png | image/png | 116.9 KB |
f4.png | image/png | 123.0 KB |
![]() |
image/png | 11.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2024-07-10 15:48:34 | Re: Calendar Table |
Previous Message | Rich Shepard | 2024-07-10 15:26:07 | Re: Finding error in long input file |