Viewing 15 posts - 3,106 through 3,120 (of 10,143 total)
CONVERT uses style codes to control output and input formatting:
declare @ToDate datetime, @FromDate datetime
SELECT -- UK format
@FromDate = CONVERT(DATETIME,'21/06/2014',103),
@ToDate = CONVERT(DATETIME,'21/07/2014',103)
select @FromDate,...
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
July 21, 2014 at 6:20 am
wBob (7/21/2014)
SELECT c2.*
FROM ( SELECT DISTINCT CoverageCode FROM dbo.[Contract] ) x
CROSS APPLY ( SELECT TOP 5 * FROM dbo.[Contract] c WHERE...
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
July 21, 2014 at 6:08 am
T-SQL beginnger (7/18/2014)
Any help for the 2nd part guys ?
I agree with Luis, it's very difficult to work with filters as complex as this without sample data. However, 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
July 21, 2014 at 5:29 am
Here's the final solution:
;WITH
SeqID1 AS (
SELECT x.ID, x.RowID, x.Value, MAXReadingdate = x.Readingdate
FROM (
SELECT *, rn = ROW_NUMBER() OVER(PARTITION BY ID ORDER BY Readingdate DESC)
FROM #tempreadings t
) x
WHERE...
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
July 21, 2014 at 4:52 am
ramrajan (7/21/2014)
Yes that is Really Working.But i need to do additional join with deliveries to get few more records as mentioned in my post.
Yes I know. One step at 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
July 21, 2014 at 3:02 am
ramrajan (7/21/2014)
--- We Need to join The above Results Set 3 With #tempdeliveries Based ON ID and We 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
July 21, 2014 at 2:49 am
"The most recent reading which is more than 24 hours before the max reading date"?
Like this:
;WITH OrderedData AS (
SELECT *, rn = ROW_NUMBER() OVER(PARTITION BY ID ORDER BY Readingdate DESC)...
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
July 21, 2014 at 2:30 am
ramrajan (7/21/2014)
Please read it as "ReadingDate IS 24 Hours Less Than the max Reading Date "Appreciate your response
To help resolve this, I've rejigged the sample data to add a row...
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
July 21, 2014 at 2:17 am
ramrajan (7/21/2014)
.
.
-- Result 2
-- In The same Query I want the ReadingDate For Each ID And the ReadingDate IS 24 Less Than the max Reading Date of Each ID ....
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
July 21, 2014 at 2:08 am
See also this thread.
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
July 21, 2014 at 1:53 am
Sreepathi1987 (7/21/2014)
Easy One. 🙂But i think it is rather unusual, tempdb is completely wiped out whenever the SQL Server service restarts. Yes or No?
Yes, which makes tempdb useful 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
July 21, 2014 at 1:44 am
Not really. NTILE(n) splits a set into n partitions.
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
July 21, 2014 at 1:41 am
Ed Wagner (7/18/2014)
SQLRNNR (7/18/2014)
mangaCarta
Runnymede
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
July 18, 2014 at 9:49 am
pmadhavapeddi22 (7/18/2014)
I am sorry, Chris for not mentioning your name. Thanks for your support
Happy Friday 🙂
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
July 18, 2014 at 9:10 am
ramrajan (7/18/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
July 18, 2014 at 8:56 am
Viewing 15 posts - 3,106 through 3,120 (of 10,143 total)