August 16, 2019 at 5:02 am
The solution would be compatible with sql 2000 edition
below are my tables
create table dates( Dates date )
create table Stations( Dates date, Station int )
-- Dates Master Table ( I have data for 30 Years, But only provided sample data )
-- Date format (MM/DD/YYYY)
Jan 1 to Jan 31
insert into dates values('01/01/2019')
insert into dates values('01/02/2019')
insert into dates values('01/03/2019')
..................................
......................................
insert into dates values('01/31/2019')
-- From Feb 1 to Feb 28
insert into dates values('02/01/2019')
insert into dates values('02/02/2019')
insert into dates values('02/03/2019')
.............................................................
.............................................................
.............................................................
insert into dates values('02/28/2019')
-- Stations Data
insert into Stations values('01/01/2019',1)
insert into Stations values('01/02/2019',1)
insert into Stations values('01/02/2019',5)
insert into Stations values('02/03/2019',3)
I need the below output if there was a station for one day also the data should be generate for the whole month with series
Dates Stations
01/01/2019 1
01/02/2019 1
...........................
...........................
...........................
...........................
...........................
01/31/2019 1
01/01/2019 5
01/02/2019 5
...........................
...........................
...........................
........................... .
..........................
01/31/2019 5
02/01/2019 3
02/02/2019 3
...........................
...........................
...........................
...........................
...........................
02/28/2019 3
August 16, 2019 at 12:27 pm
You have 2 tables?
The output you're looking for:
Does the "Dates" table contain a date for every day on the calendar? What format does the "series" returned with the month need to be in?
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply