Search Postgresql Archives

Calendar Table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a Calendar table that need to be displaying Fiscal Start and End Date as in below:

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");

--

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: 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: Book1.xlsx
Description: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

Attachment: f5.png
Description: PNG image

Attachment: f2.png
Description: PNG image

Attachment: f1.png
Description: PNG image

Attachment: f3.png
Description: PNG image

Attachment: f4.png
Description: PNG image

Attachment: f6.png
Description: PNG image


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux