ihatelag
asked on
SQL code to get data more than 1 month ago from current date
Hi there,
I need help creating a SQL Select query to get data *more* than one month ago from the current date.
I want to retreive the balance of all customers which = 0 (against the above criteria)
There are 5 columns. CustomerID, Date, BalanceEur, BalanceUSD, BalanceGBP
(date is in datetime format)
Please can you help me to create the SQL query to get this information
Many thanks
I need help creating a SQL Select query to get data *more* than one month ago from the current date.
I want to retreive the balance of all customers which = 0 (against the above criteria)
There are 5 columns. CustomerID, Date, BalanceEur, BalanceUSD, BalanceGBP
(date is in datetime format)
Please can you help me to create the SQL query to get this information
Many thanks
Select CustomerID, [Date], BalanceEur, BalanceUSD, BalanceGBP
Where BalanceUSD=0 -- any one will do right, since 0 at any conversion=0
AND [Date] < DateAdd(m, -1, GetDate())
Where BalanceUSD=0 -- any one will do right, since 0 at any conversion=0
AND [Date] < DateAdd(m, -1, GetDate())
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Solid work! Works a treat! Thanks for this!
ASKER
Thanks for this imitchie, this works great!
Glad I could help :)
Have a good day
Have a good day
Open in new window