Hi I am a newbie in SQL syntax.
I would like to have a query results in SQL using the below syntax.
Select * from tblSales where duedate <= todate
But when i run it was an error.
Please advise me for the correct syntax.
Thanks
Hi I am a newbie in SQL syntax.
I would like to have a query results in SQL using the below syntax.
Select * from tblSales where duedate <= todate
But when i run it was an error.
Please advise me for the correct syntax.
Thanks
In your question the RDBMS is not mentioned..
For SQL Server your query should be
Select * from tblSales where duedate <= GETDATE()
where GETDATE()
return the current system date and duedate
should be a date datatype.
If you are using oracle to get current system date you can use SYSDATE
select * from(
select datediff(day,getdate(),Duedate )as Diff,
SInumber ,InvoiceNo,Customer ,Tradedate,PaymentTerms,Duedate,Amount
from tblSales )as D where DIFF <= '10'
This is the Query i want..and it solved!
You could try this:
SELECT * FROM tblSales WHERE DATE(duedate) <= CURDATE();
I don't test it yet. Hope it works