cancel
Showing results for 
Search instead for 
Did you mean: 

Problem In Query With GetDate() Funtion

Former Member
0 Kudos

Hi All,

I am having a little problem with a query where I want to set it up as an alert. The problem seems to lie with the getdate function in my query. I want to return all invoices for the current day that have discounts assigned to them however it seems that when I use the getdate function it is not working. Does somebody know how I can get around this please.

Here is my query I wrote in the words not equal as it seems it does not show when I post it.

SELECT     DocNum, CardCode, CardName, DocDate, DocTotal, DiscPrcnt
FROM         OINV
WHERE     (DiscPrcnt "not equal" 0) AND (DocDate = GETDATE())

Accepted Solutions (1)

Accepted Solutions (1)

former_member187989
Active Contributor
0 Kudos

Try this query

SELECT     DocNum, CardCode, CardName, DocDate, DocTotal, DiscPrcnt
FROM         OINV
WHERE     (DiscPrcnt != 0) AND (DateDiff(dd,DocDate,GETDATE()) = 0)

Jeyakanthan

Former Member
0 Kudos

Thank you so much Jeyakanthan A

I just could not remember about datediff.

Answers (1)

Answers (1)

former_member187989
Active Contributor
0 Kudos

Alert is working now ??

Former Member
0 Kudos

Yes it is thanks so much.