Viewing 15 posts - 5,551 through 5,565 (of 10,143 total)
;WITH CTE AS (
SELECT
Name,
[Month],
[Year],
Mark,
rn = ROW_NUMBER() OVER(PARTITION BY Name ORDER BY <<Something>>)
FROM tblStudent
)
SELECT
Name,
[Month],
[Year],
Mark
FROM CTE
WHERE rn = 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
September 27, 2012 at 5:38 am
deyvisonsouto (9/27/2012)
it's just use convert(int, <<value>>)eq:
select convert(int,2.5)
result:
2
Nope! Miles off. Did you read the spec?
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
September 27, 2012 at 5:23 am
Evil Kraig F (9/26/2012)
...OPENQUERY is another way I'd forgotten to enforce this, though it's not one I'd typically prefer to use... but I forget why I came to that decision.....
Craig,...
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
September 27, 2012 at 1:47 am
halifaxdal (9/26/2012)
My bad! I hit another sp, it works, amazingly like what I expect. Thanks lots.
Any time. There's a great set of articles by Paul White covering APPLY, links in...
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
September 26, 2012 at 9:50 am
Post the whole query, mate...
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
September 26, 2012 at 9:44 am
(CROSS) APPLY is ideal for this:
CROSS APPLY (
SELECT DueStatus =
case
When NextReviewDate < getDate() then 'Over Due'
When NextReviewDate >= getDate() And NextReviewDate < getDate() + 30 then 'Due In...
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
September 26, 2012 at 9:23 am
antonio.estima 4150 (9/26/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
September 26, 2012 at 8:26 am
tim_harkin (9/26/2012)
DECLARE @currentTime DATETIME
SET @currentTime = GETDATE()
SELECT CAST(DATEPART(year,@currentTime) AS CHAR(4))
+ CASE WHEN (DATEPART(month,@currentTime)) > 10 then (CAST(DATEPART(month,@currentTime) AS CHAR(2)))
ELSE '0' + CAST(DATEPART(month,@currentTime) AS CHAR(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
September 26, 2012 at 7:32 am
antonio.estima 4150 (9/25/2012)
... Now, the filter "where SUBSTRING (nomeint, 1,1) = 'P' ", which is in subquery is precisely to bring unit not equals "PA" ...
This doesn't make sense.
SUBSTRING (nomeint,...
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
September 26, 2012 at 7:20 am
Charmer (9/26/2012)
Charmer (9/26/2012)
I have a doubt regarding joining two tables, so i came here to...
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
September 26, 2012 at 7:05 am
PiMané (9/20/2012)
Is it possible to have a column on table A that references table B or table C depending on another column on table A?
For example:
EntityAddresses (EntityAddressId, EntityType, EntityID, Address)
Customers...
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
September 26, 2012 at 4:51 am
saidapurs (9/26/2012)
Using below conversion i am getting date only like 20120926 but my requirement is 201209261015 like hour & time
convert(nvarchar(50),(GetDate()),112))
Please help...
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
September 26, 2012 at 3:39 am
Abu Dina (9/26/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
September 26, 2012 at 3:06 am
Lynn Pettis (9/25/2012)
with rCTE as (
select
t1.retained,
t1.dropped,
t1.retained as TopLevel
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
September 26, 2012 at 2:21 am
Steven Willis (9/25/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
September 26, 2012 at 1:43 am
Viewing 15 posts - 5,551 through 5,565 (of 10,143 total)