Viewing 15 posts - 2,701 through 2,715 (of 3,489 total)
I have not seen it, but I've watched some of his presentations. He knows his stuff, for sure. There aren't many SQL Server Masters, and he is one -...
January 20, 2015 at 11:17 pm
I agree. Cool solution Eirikur... I just cheated on the ASCII part... and ROW_NUMBER() was a handy surrogate.
January 20, 2015 at 11:16 pm
Why the "not using ROW_NUMBER()" restriction? It works!!
Table scripts:
CREATE TABLE A (num1 TINYINT PRIMARY KEY);
GO
INSERT INTO A(num1) VALUES (1),(2),(3),(4),(5);
CREATE TABLE B(ltr CHAR PRIMARY KEY);
GO
INSERT INTO B(ltr) VALUES('a'),('b'),('c');
SQL:
SELECT num1, x.ltr...
January 20, 2015 at 8:49 pm
Since you're new, we'll try to be gentle... no guarantees though. Help yourself by reading Jeff's article "Forum Etiquette: How to post data/code on a forum to get the...
January 20, 2015 at 3:03 am
To do what you want, you need a Calendar table with all the Months/Years you want, and then outer join that to your Invoices table.
Something like...
SELECT c.Year, c.MonthNumber, SUM(i.InvoiceAmount) AS...
January 20, 2015 at 1:46 am
Try using DelimitedSplit8K.
Read this article:http://www.sqlservercentral.com/articles/Tally+Table/72993/
Folks here help people, they don't usually do their work for them. So show us what you tried...
January 19, 2015 at 11:06 pm
Your data is contradictory. A vehicle is moving whenever Speed>0, but your data says that it's not moving unless speed>1.
If you have SQL Server 2012 or later this can...
January 18, 2015 at 12:09 am
Yes to all three.
The confusing part for me was how to compare a group of sales from one year to another year when the territory definitions are changing. (So that...
January 15, 2015 at 7:30 pm
Jeff,
Oh, I think I get it now... So each time a customer got assigned to a different territory, then I would have to create a new record for that customer...
January 15, 2015 at 7:27 pm
I would look around for Jeff Moden's article(s) on hierarchies. Not sure if he uses a CTE or not.
January 15, 2015 at 5:41 pm
The code helps some, but a table definition (create table script) for the table the data is in would help a lot. (and some sample data).
On to the question...
January 15, 2015 at 12:42 pm
If you want to group the non-top 5 into one group, then you could do it in T-SQL and then create your report based on that.
Here's a quick sample (sorry,...
January 14, 2015 at 9:07 pm
Something is odd here. How are you creating your grand totals?
Can you post a report with dummy data, so we can recreate the problem?
I've just never heard of totals...
January 14, 2015 at 11:14 am
Re-reading this... Welcome!
Those are ROWS, thank goodness! Across columns is NOT fun. Best way is to post consumable data...
This looks like it works:
SELECT P.Id, P.Price, P.CurType,...
January 13, 2015 at 10:49 pm
What I want to do, is allow the user to select ALL results, or only the results that are above the specified limit for each limit
A simplified version of your...
January 13, 2015 at 9:33 pm
Viewing 15 posts - 2,701 through 2,715 (of 3,489 total)