Viewing 14 posts - 1 through 14 (of 14 total)
Hi
I've found a solution but would still like to learn how to optimize it.
This is what's worked for me. I've changed the date as you suggested and for my...
June 10, 2014 at 12:08 am
That is perfect thank you
The solution needs the SUM() function though for my requirements,
SELECT SUM(ABS(k.Amount + k.VATAmount)) AS TOTAL.
Love this site!
December 31, 2013 at 4:35 am
This is what worked for me. Thank you very much.
;WITH CTE AS
(SELECT Top 1 Amount+VATAmount AS TOTAL
FROM FAAccKitty WITH(NOLOCK)
inner JOIN FAAccWinners on FAAccKitty.PlaceID=FAAccWinners.PlaceID
INNER JOIN Reservations WITH(NOLOCK) ON (Reservations.PlaceID...
December 31, 2013 at 3:47 am
Thank you I have got it working now with the CTE the ABS() function was missing.
I will however try to implement your other suggestions as they seem quite interesting
Thank you...
December 31, 2013 at 3:07 am
Appending the table name didn't work the strange thing is though if I use
just the SELECT from your code I get all my previous values coming as negative.
SELECT Amount+VATAmount...
December 31, 2013 at 2:00 am
Please ignore my second data structure post I thought the first didn't get posted.
Will try appending the table name now
December 31, 2013 at 1:49 am
Not sure why I'm getting the negative SUM total because there are no
negatives in the dataset.
I've been able to get the data structure as requested if that helps
SET ANSI_NULLS ON
GO
SET...
December 31, 2013 at 1:42 am
As I said I'm getting negative value for total but I don't have any negative values in
the dataset.
I've been able to get the data table structure if that helps.
SET ANSI_NULLS...
December 31, 2013 at 1:28 am
This works if I take out the TOP 1. I'm getting the right total value but it comes out as a negative?
The Amount and VatAmount fields are both set to...
December 31, 2013 at 1:09 am
The desired output is all the amounts added up to give one value
Without the SUM function I just have like 9 records for example like this
2400.00
2640.00
1900.00
478.80
750.00
600.00
1030.00
980.00
425.00
I just want these added...
December 31, 2013 at 12:47 am
Getting syntax errors for this
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near ')'.
Msg 156, Level 15, State 1, Line 11
Incorrect syntax near the keyword 'AND'.
Msg 156, Level 15,...
December 31, 2013 at 12:42 am
Getting these
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '='.
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near ')'.
Msg 156, Level 15, State 1, Line 9
Incorrect syntax...
December 31, 2013 at 12:35 am
Thank you that looks like it might do the trick.
And no I'm not aware of the pitfalls of No Lock could you please elaborate?
Also what is a CTE. Is this...
September 27, 2013 at 4:31 am
Are you kidding me?
I just put this up and you give me a solution that works.
This site rocks
Thanks
My apologies as well I think I posted this question in the wrong...
April 13, 2010 at 1:53 am
Viewing 14 posts - 1 through 14 (of 14 total)