I need to do a daily sum, in the last 30 days. I have this query that fetches data from two tables, but if exists a date in the second table (CabCC) and there is not in first table (CabFT), the value is not shown. How can I change the query to automatically generate the last 30 days in Select Datedoc.
SUM(CASE WHEN Type='FT' AND Anl = 0 THEN isnull(value*cota,0) END) AS 'Invoice',
(SELECT sum(Valuedoc)from CabCC where DateDocF=CabFT.Datedoc) as 'Rec'
group BY Datedoc
ORDER BY Datedoc desc
Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.
Why is this different from all of the other step by step guides? Because I make a living as a DBA and not as a writer and I lived through this experience.
Defining the name:
When I talk to people they say different names on this subject stuff l…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at: