Viewing 15 posts - 6,196 through 6,210 (of 10,143 total)
Sean Lange (6/25/2012)
Is there a question here?
Only yours, Sean 😉
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 25, 2012 at 7:53 am
No problem:
select distinct likp.VBELN as delivery,vbak.VBELN as sales_document,vbrp.VBELN as bill_no,
vbrk.FKDAT as invoice_date,AUDAT as sales_order_date,likp.ZZCND as delivery_date,likp.PODAT as POD_date,
submission_date as sub_date,vbak.ZZP01 as payment_rule,vbrk.ZTERM as payment_term,
(case
when vbak.ZZP01 = 'A' then DATEADD(DD,x.DateDelta,likp.ZZCND)
when vbak.ZZP01...
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 25, 2012 at 7:40 am
Don't forget the rCTE version:
;WITH OrderedData AS (SELECT *, rn = ROW_NUMBER() OVER (ORDER BY HotelId, RoomTypeId, DateKey DESC) FROM @booking),
Calculator AS (
SELECT rn, Id, HotelId, RoomTypeId, DateKey, FreeCount,
Availability =...
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 25, 2012 at 7:24 am
Change the final select to this:
SELECT
LevelNum,
MemberID,
sortorder,
ProductID, SaleClosedPrice,
CAST(REPLICATE(' | ', LevelNum - 1) + MemberName AS VARCHAR(100)) AS MemberName,
[Commission%],
[Incentive%]
FROM Hierarchy
CROSS APPLY (SELECT [Commission%] = CASE WHEN LevelNum = 1...
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 25, 2012 at 6:24 am
SaleClosePrice and Commission% are both returned by me last query. I can't understand where you are having a problem - surely all you have to do is multiply the two?
DECLARE@MemberID...
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 25, 2012 at 5:51 am
sivag (6/25/2012)
from the closed price of the sale only the...
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 25, 2012 at 5:09 am
vinu512 (6/25/2012)
Thanks for all the replies. I solved the problem. Well, technically... I didn't solve it, I took a Work around.
My Procedure had the following Query:
SELECT Distinct a.BookCode, b.MaterialType,...
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 25, 2012 at 5:04 am
sivag (6/25/2012)
CAST(REPLICATE(' | ', LevelNum - 1) + MemberName AS VARCHAR(100)) AS MemberName,
[Commission] = CASE WHEN LevelNum = 1 THEN 6 ELSE 2 END
i need...
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 25, 2012 at 4:42 am
Try this. I've left in several columns to show how the query works, and omitted the final aggregate of the results.
DECLARE@MemberID INTEGER = 1
;WITH
MemberAndParent AS (
SELECT m.MemberID, m.Name AS...
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 25, 2012 at 4:16 am
Please make sure your DDL/DML statements actually do work before posting them here.
A few questions:
How much commission does Siva get for selling ProductID = 1?
How much commission does Siva get...
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 25, 2012 at 3:48 am
vinu512 (6/25/2012)
I've simplified the requirement further.
The following query runs in 4 seconds on the above mention table having 40,000+rows bringing back the...
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 25, 2012 at 2:42 am
Ted_Kert (6/24/2012)
How do I know if a join (e.g., INNER, OUTER, etc.) is a star or merge join?
What's your context? If you're attempting to identify Star-join optimisation, then here's a...
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 25, 2012 at 2:10 am
dwain.c (6/22/2012)
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 22, 2012 at 7:20 am
Nthuloane.Marotholi (6/22/2012)
select distinct C.*...
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 22, 2012 at 3:42 am
dwain.c (6/22/2012)
When I posted the article, Jeff took a shot at...
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 22, 2012 at 3:28 am
Viewing 15 posts - 6,196 through 6,210 (of 10,143 total)