January 8, 2020 at 8:11 pm
Hi Frederico,
tried, but it's slower and the result are not the same (much more rows). I hope to get more information tomorrow that I can share with you.
Thanks.
January 12, 2020 at 6:30 am
I am sorry for the delay, I was travelling. I have more information that I think it can help. STDORD table has standard orders. System is for people leaving at home and they order the food for every day. So, basically, you have an order running for a certain period of time. It could happen that they change something in the meal they order, and that generates a new order, with a new date, which will be running until a new change.
We are analyzing a period of 3 months (@FDATO and @TDATO) and, for every day, we need to know which is the standard order active or running, so that is way the CROSS APPLY is trying to get the MAX(DATO). Normally there are not so many changes and MAX(DATO) will have the same value or maybe 2 or 3, no more than that so I am sure there s a better way to get that. Question is how.
Hope this helps.
Viewing 2 posts - 16 through 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply