This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

DateTime Logic for SWQL

Trying to query for everything last month. This bit works great in SQL...what is the equivalent in SWQL?

DateTime BETWEEN DATEADD(MONTH,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0)) AND DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0))

Parents Reply
  • SELECT i.INTERFACEID,i.OutPercentUtil,i.Datetime
    FROM Orion.NPM.InterfaceTraffic i
    --WHERE i.interfaceid = '10075' AND ((i.DateTime BETWEEN DATEADD(MONTH,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0)) AND DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0)) <- SQL
    WHERE i.interfaceid = '10075' AND (i.DateTime BETWEEN (adddate ('month',-1,GETDATE())) and GETDATE()) -- <- SWQL
    ORDER BY DATETIME DESC

Children