Viewing 15 posts - 8,671 through 8,685 (of 10,143 total)
Here's another way:
-- sample data
DROP TABLE #temp
CREATE TABLE #temp ([ChapterPageTitle] VARCHAR(9), [No.OfPages] INT)
INSERT INTO #temp ([ChapterPageTitle], [No.OfPages])
SELECT 'Chapter 1', 2 UNION ALL
SELECT 'Chapter 2', 4 UNION ALL
SELECT 'Chapter...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 18, 2009 at 5:34 am
Bruce W Cassidy (3/17/2009)
[font="Verdana"]Happy join? :w00t:I miss Oracle's natural join. "Just join the two tables, dammit! I've already told you what the foreign key relationship is..."
[/font]
It was...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 17, 2009 at 2:51 pm
Steve Jones - Editor (3/17/2009)
Green Beer!!are we free associating now?
Beer! Hell yeah we know about this stuff! You want green beer? With or without the dye?
Check this one out 😎
SELECT...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 17, 2009 at 2:29 pm
Jack Corbett (3/17/2009)
GilaMonster (3/17/2009)
Bob Hovious (3/17/2009)
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 17, 2009 at 8:24 am
There seems to be an inverse square law operating between the amount of time and effort you put into a post, and the chance of the OP responding at all...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 17, 2009 at 8:19 am
GilaMonster (3/17/2009)
Bob Hovious (3/16/2009)
Gail, do you have any recommendations from your part of the world?
If you're into wines, you absolutely must not miss the Stellenbosch wines (Cape Town, South Africa)....
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 17, 2009 at 7:47 am
rajendran.e (3/17/2009)
Thanks for your reply..:)
Mentioned Query will return duplicate value
noo namee ...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 17, 2009 at 6:32 am
Christopher Stobbs (3/17/2009)
does my solution not work???I'll test it with a million rows and see what happens...
OH and you haven't given us an example of a different start position?
It matches...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 17, 2009 at 5:01 am
What do you want the output to look like if @StartPosition contains 1 and @endposition contains 3?
How do the @StartPosition and @endposition correspond to values in the table? It's not...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 17, 2009 at 4:43 am
Then bring the two queries together:
SELECT q1.No, q1.Nome, q1.SaldoCCO, q2.saldoLR
FROM (SELECT dt.No, dt.Nome, SUM(dt.PENDENTESDEB - dt.PENDENTESCRD) AS SaldoCCO
FROM (SELECT cc.No, cc.nome as Nome,
-- block 1
CASE WHEN origem =...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 17, 2009 at 4:30 am
Restrict the SELECT column list to the columns we need, and get rid of the unnecessary "onion skin":
SELECT No, Nome, SUM(PENDENTESDEB - PENDENTESCRD) AS SaldoCCO
FROM (SELECT No, cc.nome as Nome,...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 17, 2009 at 4:15 am
Since this is an "onion" select - there's a select of a select of a select - we can use one of them to calculate Saldo instead of having that...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 17, 2009 at 4:10 am
Resolving the correlated subqueries as derived tables gives two CASE blocks - I guess debit and credit, and a third block which calculates the difference between the two as 'Saldo':
SELECT...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 17, 2009 at 3:07 am
Here's the same query after 10 minutes spent reformatting it to make it a little more readable:
SELECT No, nome, SUM(Saldo) as 'SaldoCCO'
from
...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 17, 2009 at 2:24 am
This query would be a heck of a lot simpler - and probably much faster - if all those repetitive correlated subqueries were replaced by derived tables:
SELECT No,nome, SUM(Saldo)...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 16, 2009 at 11:23 am
Viewing 15 posts - 8,671 through 8,685 (of 10,143 total)