Click here to Skip to main content
Sign Up to vote bad
good
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:27
ttds572

Comments
Vyacheslav Voronenko - 27 Jan '13 - 12:33
What have you already tried?
Mike Meinz - 27 Jan '13 - 13:25
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:49
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
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
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 464
1 Mahesh Bailwal 373
2 Maciej Los 255
3 Rohan Leuva 175
4 CPallini 175
0 Sergey Alexandrovich Kryukov 9,402
1 OriginalGriff 7,204
2 CPallini 3,933
3 Rohan Leuva 3,211
4 Maciej Los 2,743


Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid