I to be trying to uncover the perform of certain job # indigenous load day in our database with the details condition and I need to use inner join as well. I desire to have actually last 15 days precious of job # in my keep procedure. Exactly how do I set up the LoadDate that will readjust auto for last 15 work only.

You are watching: 15 days before today

Here is my query:



You can use

CONVERT(date, DATEADD(DAY, -15, GETDATE()))insted your fix day Value.

With this password you recieve the current Date GetDate() and substract 15 work DateAdd(day, -15, DateValue)

Finaly you transform it into date Typ Convert(date, value) otherwise girlfriend would obtain the existing time, too.


Your query must be together follow:

select pr.Job_Number, Count(ItemCode1) as , si.PackageCompletefrom processed_record prinner sign up with scanner_2 si top top pr.ItemCode1 = si.ItemCode1where pr.Format_Name choose "%Lin%" and pr.LoadDate >= DATEADD(DAY,-15,GETDATE())group through pr.Job_Number, si.PackageCompleteorder by si.PackageComplete, pr.Job_NumberGETDATE() will get the existing date and DATEADD() duty will add (subtract) -15 days.


Thanks because that contributing an answer to ridge Overflow!

Please be certain to answer the question. Provide details and share your research!

But avoid

Asking for help, clarification, or responding to other answers.Making statements based upon opinion; back them up with referrals or an individual experience.

See more: Yer Metal Is Olde: Today Is The Day Temple Of The Morning Star

To learn more, watch our tips on writing an excellent answers.

article Your prize Discard

By clicking “Post your Answer”, you agree come our regards to service, privacy policy and cookie plan

Not the answer you're feather for? Browse other questions tagged sql-server counting days or ask your own question.


site style / logo design © 2021 stack Exchange Inc; user contributions licensed under cc by-sa. Rev2021.9.21.40253

her privacy

By click “Accept every cookies”, friend agree ridge Exchange can store cookies on your machine and disclose details in accordance with our Cookie Policy.