sql - Filtering Date for current date -30 days fails -
i still learning sql , have sample database , trying show orders in past 30 days. can tell me code incorrect, , how fix it?
select c.firstname || ' ' || c.lastname customer, o.orderdate customer c o.orderdate >= dateadd(day,-30, getdate()) , o.orderdate <= getdate() left join orders o on c.customerid = o.customerid
i apprecaite assistnce.
on side note looking sql coach wensday , thrusday of coming week these kind of questions. willing pay via paypal , provide webex work. wouldn't think more total of 4-5 hours oveall. if care out student , make quick money please let me know email address.
thank you!
one option use sysdate
offset appropriate interval
:
select c.firstname || ' ' || c.lastname customer, o.orderdate customer c left join orders o on c.customerid = o.customerid o.orderdate >= sysdate - interval '30' day , o.orderdate <= sysdate
Comments
Post a Comment