Click here to Skip to main content
11,705,212 members (52,269 online)
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
ttds852
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 Sergey Alexandrovich Kryukov 525
1 OriginalGriff 244
2 ppolymorphe 126
3 F-ES Sitecore 110
4 Andy Lanng 85
0 OriginalGriff 8,988
1 Sergey Alexandrovich Kryukov 8,272
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,606


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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100