Hello,
I need to create a table in sql server in which
In the first column , the first row should to have a data from inception till jan end date, and second row should have data from inception till feb end dateand
third row should have data from inception till march end date. .
In the second column, first row needs to have a data of only jan date, and second row should have data of only feb date and
third row should have data of only march date.

Naimish MakwanaRank #324 · 7.7K reputationPosted May 8, 2023, 8:20 AM EDT
Try below
CREATE TABLE myTable ( col1_start_date DATE, col1_jan_end_date DATE, col1_feb_end_date DATE, col1_mar_end_date DATE, col2_jan_date DATE, col2_feb_date DATE, col2_mar_date DATE ); INSERT INTO myTable (col1_start_date, col1_jan_end_date, col1_feb_end_date, col1_mar_end_date, col2_jan_date, col2_feb_date, col2_mar_date) VALUES ('', '', '', '', '', '', '');You'll need to replace
,,,,,, andwith the actual dates you need to use in your table.For example, if your inception date is January 1st, 2021 and your January end date is January 31st, 2021, you would replace
with'2021-01-01'andwith'2021-01-31'. Similarly, replaceandwith the February and March end dates, respectively, and,, andwith the January, February, and March dates, respectively.Thanks
Preetham ThangammaRank #7,001 · 251 reputationPosted May 9, 2023, 6:07 AM EDT
Hi Naimish Makwana
My requirement is to retrieve the data first using the where condition and then insert it into another table.So, i need the guidance to write the where clause for the above mentioned requirement
Thank you