Viewing 15 posts - 2,401 through 2,415 (of 4,087 total)
I believe that this does the same thing, but without the CTE. It was impossible to do a performance comparison on such small data.
SELECT i.rowid, i.CustomerID, i.InvoiceNumber, i.InvoiceTotal, i.InvoiceAge,...
September 8, 2016 at 10:10 am
Also, my approach can easily be used with derived tables, again being consistent. You're approach could quickly become cumbersome with derived tables.
Drew
September 8, 2016 at 9:55 am
david.wright-948385 (9/8/2016)
Phil Parkin (9/8/2016)
I disagree. It makes perfect sense. He *always puts ON clauses on separate indented lines* – perfectly consistent.
That's the point I'm making - it's consistent, but no...
September 8, 2016 at 9:39 am
The Dixie Flatline (9/8/2016)
September 8, 2016 at 8:58 am
What are your expected results? It's certainly not clear from your description.
Drew
September 7, 2016 at 3:03 pm
Are you by any chance looking for this?
SELECT TOP(5) * FROM TopSellerInstrumentsLastWeek i
FULL OUTER JOIN TopSellerScoringLastWeek sc
ON i.pf_id = sc.pf_id
FULL OUTER JOIN TopSellerStyleLastWeek st
ON i.pf_id = st.pf_id
OR sc.pf_id = st.pf_id
ORDER...
September 7, 2016 at 1:14 pm
Luis Cazares (9/7/2016)
colin.dunn (9/7/2016)
Put the join ON clauses on the same line since they were so short.
I usually have my ON clauses on the same line as my JOIN, but...
September 7, 2016 at 9:56 am
20,000+ rows does not constitute SAMPLE data. If you need more than 100 rows to illustrate your problem, then it's too complex for a free forum. Why...
September 6, 2016 at 4:15 pm
You need to set the user's default schema.
Drew
September 6, 2016 at 3:15 pm
There are several issues here.
1) Your data is not in a format that people can cut and paste it into SSMS to get started. Follow the instructions in...
September 6, 2016 at 2:29 pm
The Dixie Flatline (9/5/2016)
SUM([CY_Quantity]) OVER (PARTITION BY [Customer], [Product], [Year]
...
September 6, 2016 at 12:56 pm
If you're not sure, instead of using an "OR", add another CASE. This will both make it easier to understand your logic and prevent problems with not specifying the...
September 6, 2016 at 12:20 pm
Lynn Pettis (9/1/2016)
ScottPletcher (9/1/2016)
Luis Cazares (9/1/2016)
drew.allen (9/1/2016)
First, the mantra is "It's a bad idea to declare a cursor. Period. End of sentence." 😀Drew
Second, cursors can be local or global and...
September 1, 2016 at 2:03 pm
First, the mantra is "It's a bad idea to declare a cursor. Period. End of sentence." 😀
T-SQL is not C#. It's certainly easy enough to test.
DECLARE @i INT =...
September 1, 2016 at 12:02 pm
One thing I noticed is that you spread out Aj_total into different balances based on Age, and then the next thing you do is a series of queries to collapse...
September 1, 2016 at 10:51 am
Viewing 15 posts - 2,401 through 2,415 (of 4,087 total)