Click here to Skip to main content
13,513,903 members
Rate this:
Please Sign up or sign in to vote.
See more:
I want to write the query statement for
select the price by latest date from Price table within the 60 days

Posted 27-Jan-13 6:27am
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 :

1 solution

Rate this: bad
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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180417.1 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2018
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