Viewing 15 posts - 3,226 through 3,240 (of 10,143 total)
pwalter83 (6/19/2014)
Sachin Nandanwar (6/19/2014)
SELECT SUM(YourSum) FROM
(
SELECT SUM(CASE WHEN SOA_TYPE = 'Agent' THEN USD_AMOUNT ELSE 0 END) +
SUM(CASE WHEN SOA_TYPE = 'Freight' THEN USD_AMOUNT ELSE 0 END) +...
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
June 23, 2014 at 1:47 am
Are we good so far?
DECLARE @fromDate DATE = 'Apr 01 2008'
DECLARE @tODate DATE = 'Apr 30, 2014'
DECLARE @NumberOfRecords INT = 6
DECLARE @period VARCHAR(10) = 'monthly' -- (This can...
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
June 20, 2014 at 8:08 am
KnowledgeSeeker (6/20/2014)
Exactly.
Good. You have some guesses - which is nice.
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
June 20, 2014 at 7:32 am
Or:
UPDATE t1 SET
P = T.NewP
FROM table_1 t1
CROSS APPLY (
SELECT NewP = ISNULL(MAX(p),0)+1
FROM table_1 t2
WHERE t1.link = t2.link
) t
What can you tell us about the distribution of values...
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
June 20, 2014 at 7:30 am
pwalter83 (6/20/2014)
Sachin Nandanwar (6/20/2014)
(SELECT SUM(CASE WHEN SOA_TYPE IN ('Agent','Freight','Cost') or AC = '16208'THEN USD_AMOUNT ELSE 0 END) YourSum
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
June 20, 2014 at 7:13 am
KnowledgeSeeker (6/20/2014)
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
June 20, 2014 at 6:12 am
KnowledgeSeeker (6/20/2014)
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
June 20, 2014 at 6:01 am
KnowledgeSeeker (6/20/2014)
CREATE TABLE #SampleData
(
BaseYear INT,
TransYear INT,
ClientName VARCHAR(50),
DepID INT,
Revenue, INT,
TransactionDate DATETIME
)
INSERT...
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
June 20, 2014 at 5:42 am
daniarchitect (6/19/2014)
bitbucket-25253....wasted my time what a response
If Bitbucket's explanation doesn't exactly meet your requirements, then simply ask what you need to know. Rudeness is unnecessary and unprofessional.
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
June 20, 2014 at 1:40 am
Eugene Elutin (6/19/2014)
...and the example was later extended for use as a TSQL recruiting test.
have you ever tried asking on interview what kind of results the following statement will produce:
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
June 19, 2014 at 9:50 am
autoexcrement (6/19/2014)
What a fantastic explanation! Thank you so much for taking the time!
You're welcome - but the time was taken a while ago to demonstrate a point to a colleague...
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
June 19, 2014 at 8:36 am
Eugene Elutin (6/19/2014)
...
-- Query 4
SELECT c.*, o.*, ol.*
FROM #Customers c
LEFT JOIN #Orders o
INNER JOIN #Orderlines ol
ON ol.OrderID = o.OrderID
...
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
June 19, 2014 at 8:09 am
This might help:
“You have a query which joins two tables, say Customers and Orders. It’s an outer join because you want all customers whether or not they’ve ever placed an...
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
June 19, 2014 at 1:47 am
This might get you started:
SELECT --DISTINCT
t.transactionID, b.TransDate, b.TransType, b.TransDesc1, b.TransDesc2, b.TransDesc3, b.TransDesc4, b.TransDesc5,
(b.Debit + b.Credit) as Amount,
ISNULL(r.OrthoID, 0) as OrthoID,
ISNULL(t.PatientID, 0) as PatientID,
t.ledgerAmount,
t.LedgerType,
(b.Debit + b.Credit) -...
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
June 18, 2014 at 9:37 am
mattech06 (6/18/2014)
;WITH Main as
(
SELECT
DISTINCT t.transactionID, b.TransDate, b.TransType,...
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
June 18, 2014 at 9:19 am
Viewing 15 posts - 3,226 through 3,240 (of 10,143 total)