Viewing 15 posts - 931 through 945 (of 3,957 total)
Luis Cazares (1/8/2014)
I'm sure that this is a running total problem that I would love to try with SQL 2012, but I don't have it at work.
I agree and I...
January 8, 2014 at 5:53 pm
Always the bridesmaid and never the bride.
January 8, 2014 at 5:46 pm
Luis - This is nice! Also out of the box.
select [object_id]
INTO #TableB
from sys.all_objects
WHERE 1=2
Another way that I would certainly never try at home myself.
select [object_id]
INTO #TableB
from sys.all_objects
WHERE...
January 8, 2014 at 5:43 pm
Sean Lange (1/8/2014)
This gets almost what you state you are looking for. It does not return 80, 40 but I can't understand from your data why you think that one...
January 8, 2014 at 5:31 pm
ChrisM@Work (1/8/2014)
..(you didn't see that table spool)
...
I did.
January 8, 2014 at 5:07 pm
Christian Graus (1/7/2014)
*facepalm* Sorry, I keep an eye on several forums, I forgot this one had that level of granularity....
No reason to be embarrassed or sorry. Jeff was...
January 7, 2014 at 10:48 pm
Does this give you the output you're looking for?
Print REPLICATE(' ', @@NestLevel) + CAST(@@NestLevel AS VARCHAR);
Exec('Print REPLICATE('' '', @@NestLevel) + CAST(@@NestLevel AS VARCHAR);');
Exec sp_ExecuteSQL N'Print REPLICATE('' '', @@NestLevel) + CAST(@@NestLevel...
January 7, 2014 at 10:19 pm
Another way (similar to Christian's):
WITH PreAggregate AS
(
SELECT employee_id, date_joined, date_=MAX(date_)
FROM #employee
GROUP BY employee_id, date_joined
)
SELECT employee_id, date_joined, date_, SomeCalculatedColumn
FROM...
January 7, 2014 at 10:06 pm
Christian Graus (1/7/2014)
Am I right in thinking your solution requires SS2012 ? Did we discuss that already ?
Yes absolutely. This is the SQL 2012 forum after all.
January 7, 2014 at 9:51 pm
PSB (1/7/2014)
For Grp A , where create DAte = '2013-01-01 00:00:00.000' and OpenticketsTillDate = 1, The ClosedTicketTillDate should be 3( Tickets which have ClosedDate on or after 1/1/2013 are 2013-11-23...
January 7, 2014 at 9:32 pm
This way returns the same results I reported above, but eliminates the triangular join caused by the correlated sub-query I was using originally, a.k.a. the one that Jeff groused about...
January 7, 2014 at 8:47 pm
This is what the OP said he wanted as the results (originally):
--The final result should look LIKE the below :
SELECT 'A' AS [GROUP],'1/1/2013' AS CreateDate ,1 AS OpenedTicketstillDate, 3 AS...
January 7, 2014 at 7:57 pm
Christian Graus (1/7/2014)
DECLARE @date datetime = '2013-01-01'
;WITH opened
AS(
SELECT [group], count(1) as [count] FROM #TempTable WHERE cast(createDate as date)...
January 7, 2014 at 7:31 pm
Jeff Moden (1/7/2014)
dwain.c (1/6/2014)
Jeff Moden (1/6/2014)
[EDIT]... hmmm... although.... it might just be a RANK problem, now that I think about it a bit more.
OK. You've got my attention. ...
January 7, 2014 at 7:02 pm
Jeff Moden (1/7/2014)
dwain.c (1/6/2014)
Jeff Moden (1/6/2014)
[EDIT]... hmmm... although.... it might just be a RANK problem, now that I think about it a bit more.
OK. You've got my attention. ...
January 7, 2014 at 6:48 pm
Viewing 15 posts - 931 through 945 (of 3,957 total)