Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 6th, 2006, 04:17 PM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Stored Procedure Help.

Hi there,

I have been trying to build this stored procedure but no luck so far. this is what I'm trying to accomplish;

a stored procedure to pull sales from let's say sales from a specific date 10/10/06 and I want the same stored procedure to pull sales data from one year before 10/10/05 from the first parameter.

so I want the stored procedure to pull data from one date and one year's date before.

Thanks for your help.

Midway.



Reply With Quote
  #2 (permalink)  
Old November 14th, 2006, 06:31 PM
Friend of Wrox
 
Join Date: Aug 2004
Location: Orange County, CA, USA.
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Post your attempt at the stored procedure your trying for.


Reply With Quote
  #3 (permalink)  
Old November 20th, 2006, 05:34 AM
Authorized User
 
Join Date: Aug 2006
Location: Pune, Maharastra, India.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

use this

select OrderDate, dateadd(yy,-1,OrderDate) from Orders

Reply With Quote
  #4 (permalink)  
Old November 20th, 2006, 05:36 AM
Authorized User
 
Join Date: Aug 2006
Location: Pune, Maharastra, India.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

select * from orders
where orderdate between 'date you want to start' and datediff(yy,-1,date from you want to minus 1 year)

all the best

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
stored procedure prashant_telkar SQL Server 2000 1 July 9th, 2007 07:57 AM
Stored Procedure jezywrap SQL Server ASP 1 January 2nd, 2007 11:29 PM
stored procedure kdm260 SQL Server 2000 2 June 19th, 2006 04:45 PM
Stored Procedure rajanikrishna SQL Server 2000 0 July 18th, 2005 05:01 AM
Help About Stored Procedure zhuge6 BOOK: ASP.NET Website Programming Problem-Design-Solution 3 May 20th, 2005 09:27 AM



All times are GMT -4. The time now is 08:42 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.