Viewing 15 posts - 61 through 75 (of 859 total)
Michael Valentine Jones (12/3/2012)
select
YearMonth = dateadd(mm,datediff(mm,0,[recorddate]),0),
MyValueSum = sum([myvalue])
from
#a
group by
dateadd(mm,datediff(mm,0,[recorddate]),0)
order by
dateadd(mm,datediff(mm,0,[recorddate]),0)
Results:
YearMonth ...
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
December 3, 2012 at 11:34 am
ScottPletcher (11/30/2012)
capnhector (11/30/2012)
ScottPletcher (11/30/2012)
Eugene Elutin (11/30/2012)
ScottPletcher (11/30/2012)
In the interests of being thorough, I added a Message to my proposed solution back to them:
SELECT
...as above...,
...
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
November 30, 2012 at 4:53 pm
ScottPletcher (11/30/2012)
Eugene Elutin (11/30/2012)
ScottPletcher (11/30/2012)
In the interests of being thorough, I added a Message to my proposed solution back to them:
SELECT
...as above...,
CASE...
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
November 30, 2012 at 4:39 pm
Steven Willis (11/30/2012)
IF OBJECT_ID('tempdb..#TempTable') IS NOT NULL
DROP TABLE #TempTable
CREATE TABLE #TempTable
(
InvoiceId INT...
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
November 30, 2012 at 3:42 pm
Jeff Moden (11/29/2012)
capnhector (11/29/2012)
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
November 30, 2012 at 1:42 pm
Have a look at ROW_NUMBER() OVER() and Common Table Expressions. These will allow you to accomplish what you need to do. If you need any help let us...
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
November 30, 2012 at 11:20 am
I have a slight rewrite that works. might not be better than any thing else but will eat as many sets with as many items in the set as...
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
November 29, 2012 at 2:19 pm
Jeff Moden (11/27/2012)
CELKO (11/27/2012)
Create a million row FizzBuzz table. FizzBuzz isn't a comment. It's the name of a very common problem based on a child's game, is...
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
November 28, 2012 at 5:46 pm
Alan.B (11/28/2012)
Evil Kraig F (11/28/2012)
This is NOT pretty, but it IS functional.
I am trying to understand why went with a loop vs a set-based approach. I posted a more set...
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
November 28, 2012 at 3:27 pm
What i came up with was to turn it into an adjacency list hierarchy and then we can recourse through that. of course i could be completly off base...
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
November 28, 2012 at 2:15 pm
If there is a row (3,14) would all your sample data then be returned because of (4,14) and (5,14)? from your description i think that is correct. just trying...
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
November 28, 2012 at 1:21 pm
you can accomplish this using a pivot table or cross tab. Jeff Moden has a great 2 part series of articles on this
http://www.sqlservercentral.com/articles/T-SQL/63681/ Part1
http://www.sqlservercentral.com/articles/Crosstab/65048/ Part 2
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
November 28, 2012 at 1:15 pm
so i came up with the following which is completly dynamic.
DECLARE @sql NVARCHAR(MAX) = ''
DECLARE @PivotColumn NVARCHAR(MAX) = ''
DECLARE @Start DATE = '2012-11-12'
DECLARE @End DATE =...
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
November 28, 2012 at 9:00 am
we did not include the unique constraint and do not foreign key to the accounts table on CustomerID, AccountID from the orders table. (all tables changed to reflect the...
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
November 27, 2012 at 6:07 pm
pdanes (11/27/2012)
GSquared (11/27/2012)
pdanes (11/27/2012)
For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]
Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
Jeff Moden's Cross tab and Pivots Part 1[/url]
Jeff Moden's Cross tab and Pivots Part 2[/url]
November 27, 2012 at 4:46 pm
Viewing 15 posts - 61 through 75 (of 859 total)