Viewing 15 posts - 2,506 through 2,520 (of 10,144 total)
maheendra.puttareddy (5/18/2015)
Thank you very much this is really helpful to meRegards
Maheendra Reddy
You're very welcome, and thank you for the nice feedback.
May 18, 2015 at 8:29 am
Like this?
SELECT
t.*,
x.RollingSum
FROM #team t
OUTER APPLY (
SELECT RollingSum = SUM(expense_amt)
FROM #team ti
WHERE ti.team_id = t.team_id
AND ti.date <= t.date
AND ti.date >= DATEADD(month,-3,t.date)
) x
WHERE t.date >= DATEADD(year, -1, GETDATE())
ORDER BY...
May 18, 2015 at 4:47 am
Michael L John (5/15/2015)
+ 100.I did not have enough caffeine today! As soon as I saw your post I hit myself on the head!
There won't be a person on...
May 15, 2015 at 8:41 am
maheendra.puttareddy (5/15/2015)
SET Year= casewhen MSDate > '2011/06/30' and MSDate < '2012/07/01' THEN '2012'
when MSDate > '2012/06/30' and MSDate < '2013/07/01' THEN '2013'
when MSDate > '2013/06/30' and MSDate...
May 15, 2015 at 8:25 am
cms9651 (5/14/2015)
I have problem to execute query with interval date.
If try this query I don't have problem and the output is correct:
SELECT * FROM dotable
WHERE
dotableDate...
May 14, 2015 at 7:27 am
Have a look at the REPLACE function in Books Online (SQL Server help)
May 13, 2015 at 10:08 am
There are at least two alternatives which may perform better than your original. How much better depends to a great extent on indexing:
SELECT t.*, x.SUB_TYPE
FROM #TEMP t
OUTER APPLY (
SELECT...
May 13, 2015 at 5:42 am
andrew_dale (4/30/2015)
checking the execution plan, if I run a simple query and include one of the index fields in the where clause...
May 12, 2015 at 9:28 am
-- Write the query the simplest way. It doesn't get much simpler than this:
SELECT DISTINCT
created_dttm AS Created_Datetime,
proj_task_id AS Project_Task_Id,
CAST([text] AS VARCHAR(2000)) AS [text]
FROM dbo.P_T
WHERE...
May 11, 2015 at 2:08 am
Stephen Knott (5/7/2015)
I didn't yet - but I will.
I have added COMMITTED SNAPSHOT isolation as it was the least invasive - i.e. didn't need to change any...
May 7, 2015 at 6:13 am
Stephen Knott (5/4/2015)
IF EXISTS( SELECT based on above criteria )
( UPDATE as...
May 7, 2015 at 5:24 am
-- The WHERE clause must be evaluated for each row in the Stock table
-- in order to determine which rows qualify for the UPDATE.
-- The likelyhood of a table lock...
May 5, 2015 at 10:03 am
DROP TABLE #Team
CREATE TABLE #Team
(
[FirstName] [varchar](20) NULL,
[LastName] [varchar] (20) NULL,
[Team] Varchar (20) NULL,
[TransactionID] int,
Price float,
NoofTickets int
) ON [PRIMARY]
INSERT INTO #Team
...
April 30, 2015 at 8:51 am
Have you tried a bog-standard aggregate?
SELECT ColA, ColB, ColC = MAX(ColC)
FROM …
GROUP BY ColA, ColB
April 30, 2015 at 6:37 am
Viewing 15 posts - 2,506 through 2,520 (of 10,144 total)