Viewing 15 posts - 4,216 through 4,230 (of 10,143 total)
Since the sortorder column isn't particularly useful, why don't you populate it with the sort order that you actually want?
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
August 7, 2013 at 7:20 am
-- sample data
DROP TABLE #LeaveEntry
CREATE TABLE #LeaveEntry(
[LeaveId] [int] NOT NULL,
[Name] [varchar](50) NOT NULL,
[LeaveTypeName] [varchar](100) NOT NULL,
[StartDate] [datetime] NULL,
[EndDate] [datetime] NULL
)
SET DATEFORMAT YMD
INSERT INTO #LeaveEntry VALUES
(1, 'A','OUT','2013-08-12 00:00:00.000','2013-08-14 00:00:00.000'),
(2, 'B','LON','2013-08-13 00:00:00.000','2013-08-14...
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
August 7, 2013 at 5:12 am
Use APPLY to "encapsulate" a splitter function - in this case DelimitedSplit8k[/url];
DECLARE @t Table
(
AreaID int,
AreaName nvarchar(100),
Responsible nvarchar(100)
)
Insert Into @t
Select 1, 'Finance',Null
Union All
Select 2, 'IT','Internal, External'
Union All
Select 3, 'Audit, Security', 'Internal'
Union...
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
August 7, 2013 at 1:55 am
ananda.murugesan (8/6/2013)
ok.. I will update you once getting from Dev.Team for the all details..thanks
ananda
Here's a guess at the business logic:
Where a set, partitioned on GA_Drg_NO, Rev_NO and Mark_No,
contains 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
August 6, 2013 at 9:26 am
Yes of course, but folks will need a sample data script and a decent description of what the query is supposed to do.
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
August 6, 2013 at 6:24 am
declare @Locality varchar(max)
set @Locality = 'Locality Yate'
SELECT
T.Locality,
[Specialty] = GS2.CodeDescription,
t.[Status],
[Number] = Count(T.ClientID)
FROM (
SELECT
REF.ClientID,
REF.ReferralNumber,
SpecialtyReferredTo,
ServiceTeam,
Locality = ISNULL((
SELECT TOP 1 GS.CodeDescription
FROM dbo.vwSGReferrals As REF2 -- You don't need this reference here;...
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
August 6, 2013 at 6:06 am
Not many folks will want to click on the link you posted. Can you post up a picture of the desired layout instead?
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
August 6, 2013 at 5:45 am
;WITH OrderedData AS (SELECT *, seq = ROW_NUMBER() OVER(ORDER BY DateS) FROM #LOGTABLE)
SELECT
l.DateS,
l.Value,
x.GroupColumn
FROM OrderedData l
CROSS APPLY (
SELECT TOP 1 GroupColumn = ROW_NUMBER() OVER(ORDER BY nr.seq)
FROM OrderedData tr
INNER...
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
August 6, 2013 at 5:21 am
Koen Verbeeck (8/6/2013)
You'll need to establish clear rules on how to divide the groups.
Around 20 seconds doesn't work for...
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
August 6, 2013 at 4:42 am
Bala' (8/6/2013)
... need to group based on the time ...
Please elaborate on your group definition, including an explanation of how group 2 is derived.
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
August 6, 2013 at 3:38 am
Oracle765 (8/5/2013)
@columnname1 and @columnname2 could be named anything when they are passed in as this is selected from a dynamically imported...
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
August 6, 2013 at 1:40 am
ET DATEFORMAT MDY
SELECT
DateRange = RIGHT('0'+CAST(MONTH([Date]) AS VARCHAR(2)),2)+'/'+
CAST(YEAR([Date]) AS VARCHAR(4)),
SUMAmount = SUM(Amount)
FROM (
SELECT '01/03/2012', $300 UNION ALL
SELECT '01/12/2012', $250 UNION ALL
SELECT '02/05/2012', $200 UNION ALL
SELECT '02/07/2012', $300 UNION ALL
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
August 5, 2013 at 9:06 am
SELECT CONVERT(DATETIME,RIGHT(MyDate,4)+LEFT(MyDate,4),112)
FROM (SELECT MyDate = '12252013') d
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
August 5, 2013 at 6:23 am
Brandie Tarvin (8/2/2013)
How many SQL Spackle articles are there?
Yes, I have a reason for asking. But I want 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
August 5, 2013 at 12:47 am
SELECT
DENSE_RANK() OVER(ORDER BY reference, collection_day, (rnum-1)/6 ),
*
FROM (
select
row_number() OVER (PARTITION BY reference, collection_day ORDER BY sort_date) AS rnum
,collection_day, reference, sort_date
from #temp
) d
order by reference, sort_date
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
August 2, 2013 at 4:40 am
Viewing 15 posts - 4,216 through 4,230 (of 10,143 total)