Permutation

Technical Article

RE: PLEASE HELP NEEDED? - with a select avg

  • Reply

Here's a shot in the dark:USE NORTHWIND SELECT  CustomerID  , COUNT(*) No_of_Orders  , DATEDIFF(d,MIN(OrderDate), MAX(OrderDate)) TimeSpan  , COUNT(*)*1.0 / DATEDIFF(d,MIN(OrderDate), MAX(OrderDate)) DailyOrder FROM  Orders WHERE CustomerID = 'ERNSH' AND (OrderDate >='19960717' AND OrderDate <='19960723') GROUP BY CustomerIDBtw, since this is an exercise given to you, don't you think you should find the solution yourself?

You rated this post out of 5. Change rating

2005-02-24

Technical Article

RE: Local Variables in a Stored Procedure

  • Reply

I remember having this problem too - particularly when using dates. My guess at that time was that "knowing" the date value allowed the query optimizer to do something that it couldn't do when the value was unknown - maybe looking thru the index up front?. I'd love to know more about this. regards k2

You rated this post out of 5. Change rating

2003-12-05

1 reads

Blogs

Real-World SQL Mastery: Your Hands-On, Mess-Free Sandbox

By

Are you ready to take your SQL skills from theoretical to tactical? If you've...

Set a Runtime Variable in an Azure DevOps Pipeline

By

Note: I DO NOT recommend this. Any changes to a pipeline should be in...

A New Word: Symptomania

By

symptomania – n. the fantasy that there’s some elaborate diagnosis out there that neatly...

Read the latest Blogs

Forums

7 sept, scheduled book

By philip.scott

Comments posted to this topic are about the item 7 sept, scheduled book

7 sept, schedlued article

By philip.scott

Comments posted to this topic are about the item 7 sept, schedlued article

6 sept, published book

By philip.scott

Comments posted to this topic are about the item 6 sept, published book

Visit the forum

Question of the Day

Azure Data Lake Storage Gen 2

Azure Data Lake Storage Gen 2 is built on ...?

See possible answers