Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hello friends, i have one doubt,i want to those order no which is less than system date and want to show which order no is pending from 3 days,4 days as well as.....

my querry is like.

SQL
Select distinct tddt,bqty
from bag, txnd
where byy = tdbyy
and bchr = tdbchr
and bno = tdbno
and bqty = tdbqty
and bodchr = 'abc'
and bloc ='a2b'
and bcls = 'n'
and bqty>0 and tddt >= DATEADD(day, -3, CURRENT_TIMESTAMP)
Posted
Updated 22-May-13 8:34am
v2
Comments
Sandeep Mewara 6-May-13 12:33pm    
And the issue is?
Maciej Los 22-May-13 14:37pm    
You did not provide enough information... and you tag a question in wrong way. I don't see anything what is related to VBA macros.

1 solution

Your query should looks like:

SQL
SELECT DISTINCT b.*, t.*
FROM bag AS b INNER JOIN txnd AS t ON b.IDColumn = t.IDColumn
WHERE b.bodchr = 'abc' and b.bloc ='a2b' and b.bcls = 'n' and b.bqty>0 and t.tddt >= DATEADD(day, -3, GETDATE())


More about Date functions: Date And Time Functions (T-SQL)[^]

You can use something like this too:
SQL
...
WHERE t.tddt BETWEEN DATEADD(day, -3, GETDATE()) AND GETDATE()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900