Viewing 15 posts - 4,216 through 4,230 (of 10,144 total)
;WITH base AS (
SELECT Max_DM = MAX(post_dm) FROM ztb_forecastable_metrics_hist
)
SELECT
post_dm -- etc
FROM ztb_forecastable_metrics_hist
WHERE post_dm BETWEEN DATEADD(mm,-3,base.Max_DM) AND base.Max_DM
GROUP BY Post_DM
August 7, 2013 at 7:26 am
Since the sortorder column isn't particularly useful, why don't you populate it with the sort order that you actually want?
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...
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...
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...
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.
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;...
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?
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...
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...
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.
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...
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...
August 5, 2013 at 9:06 am
SELECT CONVERT(DATETIME,RIGHT(MyDate,4)+LEFT(MyDate,4),112)
FROM (SELECT MyDate = '12252013') d
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...
August 5, 2013 at 12:47 am
Viewing 15 posts - 4,216 through 4,230 (of 10,144 total)