Viewing 15 posts - 7,111 through 7,125 (of 10,144 total)
SwePeso (11/3/2010)
You don't need a tvf here.
Quite true, but you might benefit from it a lot.
November 3, 2010 at 6:34 am
Convert your scalar function to a table-valued function. From BOL:
The APPLY operator allows you to invoke a table-valued function...
November 3, 2010 at 6:19 am
If the column 'side' indicates Buy or Sell, then the WHERE clauses for the two CTE's should be swapped around, from
;WITH Purchases AS
(-- get all of the purchases. Cross Join...
November 2, 2010 at 9:50 am
keymoo (11/2/2010)
Buy 1 unit at 1.3641
Buy 1 unit at 1.3597
Sell 2 units at 1.3594
The profit should...
November 2, 2010 at 9:26 am
Tom.Thomson (11/2/2010)
Chris Morris-439714 (11/2/2010)
DindinsA bit early for that?
Yes but not too early to plan it!
I've got chorizo, some left over roast chicken, red & green peppers and a can of...
November 2, 2010 at 8:52 am
Gianluca earns Sainthood points here.
November 2, 2010 at 8:17 am
The calculation is working as expected. Using your sample data above, you have a purchase price of 1.254000 and a sale price of 1.252700. That's a loss as you point...
November 2, 2010 at 7:45 am
I think your profit expression is incorrect:
profit = sum(p.Price - s.Price)
it should be selling price minus purchase price.
November 2, 2010 at 7:19 am
Sacheen (11/2/2010)
Yep.. it worked fine.. 😀seems like grouping won't work with case statements...! :unsure:
No, they work fine together. This[/url] article shows how to use CASE with aggregation to perform high-speed...
November 2, 2010 at 6:41 am
In addition to the key points raised by Gianluca, consider also the performance implications of putting this into a WHERE clause.
November 2, 2010 at 4:53 am
Ninja's_RGR'us (11/1/2010)
Chris Morris-439714 (11/1/2010)
Paul White NZ (11/1/2010)
Chris Morris-439714 (11/1/2010)
November 1, 2010 at 8:46 am
Paul White NZ (11/1/2010)
Chris Morris-439714 (11/1/2010)
Nah mate my walking-on-water skills are still underwhelming - don't even drink the stuff, fish f...never mind. Spill the beans! I'll try to understand, promise!
SQLCLR,...
November 1, 2010 at 7:47 am
Paul White NZ (11/1/2010)
Chris Morris-439714 (11/1/2010)
Heh - until you wrap it up nice and warm...
That helps - as usual - but it's still a bit slower than the (unmodified) XML...
November 1, 2010 at 7:39 am
Viewing 15 posts - 7,111 through 7,125 (of 10,144 total)