Click here to Skip to main content
15,882,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to write the query statement for
select the price by latest date from Price table within the 60 days


thanks,
thanda
Posted
Comments
Vyacheslav Voronenko 27-Jan-13 12:33pm    
What have you already tried?
Mike Meinz 27-Jan-13 13:25pm    
What does your SQL SELECT statement look like now?
What kind of error are you getting?
What are the definitions of the columns and tables in your database?
Valery Possoz 27-Jan-13 13:49pm    
Well... the answer is in the question! What about doing a bit of homework before asking? A good place to start reading about SQL syntax : http://www.w3schools.com/sql/default.asp

1 solution

try this
SQL
select price from price_table where DATEDIFF(DAY,[OrderDate],GETDATE()) <= 60
provided the orderDate field type is dataTime and matching field exists in your table. modify the table name and field name that suits to your requirement.
 
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