0
I have a question regarding SQL SERVER and I needed your help. I have a Query that returns me a line with a number, Start_date and End_date.
Consultation:
select 123456 as Numero, a.Data_inicio, a.Data_fim
from CLI_INTERNAMENTOS_UTENTES a
where a.Data_inicio between '20171001' and '20180601'
Upshot:
Numero Data_inicio Data_fim 123456 01/10/2017 01/06/2018
I wanted to show a record for each day until the last is equal enddate, ie:
Numero Data_inicio Data_fim Data(novo campo)
1.123456 01/10/2017 01/06/2018 01/10/2017
2.123456 01/10/2017 01/06/2018 02/10/2017
3.123456 01/10/2017 01/06/2018 03/10/2017
4.123456 01/10/2017 01/06/2018 04/10/2017
5.123456 01/10/2017 01/06/2018 05/10/2017
6.123456 01/10/2017 01/06/2018 06/10/2017
7.123456 01/10/2017 01/06/2018 07/10/2017
8.123456 01/10/2017 01/06/2018 08/10/2017
9.123456 01/10/2017 01/06/2018 09/10/2017
10.123456 01/10/2017 01/06/2018 10/10/2017
11.123456 01/10/2017 01/06/2018 11/10/2017
12.123456 01/10/2017 01/06/2018 12/10/2017
What type of each column? in your select you are treating the date as a string. How it was stored?
– Caique Romero
The type of date and datetime, but I can cast a date.
– Joaquim Carvalho
Related: https://answall.com/a/33860/69359
– Rovann Linhalis
It’s almost the same situation as that question, but this uses oracle: https://answall.com/a/299572/69359
– Rovann Linhalis
For each value of the column Number there is a single row in the table CLI_INTERNAMENTOS_UTENTES?
– José Diz