Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
I want to write the query statement for
select the price by latest date from Price table within the 60 days
 

thanks,
thanda
Posted 27-Jan-13 6:27am
ttds741
Comments
Vyacheslav Voronenko at 27-Jan-13 12:33pm
   
What have you already tried?
Mike Meinz at 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 at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

try this
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.
  Permalink  

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

  Print Answers RSS
0 CHill60 360
1 Sarvesh Kumar Gupta 238
2 OriginalGriff 193
3 Sergey Alexandrovich Kryukov 163
4 DamithSL 153


Advertise | Privacy | Mobile
Web01 | 2.8.140709.1 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid