1
I am trying to create a report based on some tables of my bank, in this report, I need to pass during the month, on which day the operation was executed, so I need to print out every day of the month, and compare them with my field of dataExecutada
.
this is my current table
This is the expected report:
Of the fields in this report I just don’t have the dates of the month
All that’s left is to spend the days of the month and compare it to mine initDate
.
How can I get this kind of information in my query
? Follow my current code:
SELECT DISTINCT vapacasset,
awp.workprocedure,
wp.workprocedurename,
awp.intervaltype,
assetwp.initdate,
CONVERT(VARCHAR, assetwp.dateinterval) + CONVERT(VARCHAR(1), CASE
WHEN assetwp.intervaltype = '2' THEN 'M'
ELSE 'D'
END) AS PERIOD
FROM asset a
INNER JOIN assetworkprocedure awp
ON a.asset = awp.asset)
INNER JOIN workprocedure wp
ON awp.workprocedure = wp.workprocedure)
INNER JOIN v_assetparentassetcl vapac
ON awp.asset = vapacasset
WHERE vapacparentasset = 'F.SP.SPO.IP'
AND awp.recordstate = 'OP'
Related: Split date ranges into weeks.
– Sorack
Related: How to allocate transactions or group by day?.
– Sorack
I need to pass the same table is in the second photo, select every day of the month (this will come as my backend parameter), and compare the day that is compatible with
initDate
of Asset, which is already being selected in the current query– Lucas Tadeu Egídio Arruda
@Sorack did the requested edits
– Lucas Tadeu Egídio Arruda
Has any response helped solve the problem and can address similar questions from other users? If so, make sure to mark the answer as accepted. To do this just click on the left side of it (below the indicator of up and down votes).
– Sorack