Viewing 15 posts - 3,571 through 3,585 (of 4,087 total)
Here is code that gives the correct result for your sample data. From there, you should be able to figure out a way to optimize it.
;WITH PlannedWork AS (
SELECT...
October 6, 2011 at 1:07 pm
I'm going to throw a wrench in the works. All of your data has had roughly equivalent start and end times for the planned and actual data. Suppose...
October 6, 2011 at 11:57 am
TDSapp (10/6/2011)
CELKO (10/5/2011)
October 6, 2011 at 11:34 am
ulteriorm (10/6/2011)
O..o It would have been incredibly simple if i had to return just the min and max on year.:-P
I think it IS that simple. Your expected results...
October 6, 2011 at 10:10 am
sqlfriends (10/6/2011)
It looks like we should use below from your previous post, will this improve performanceselect ids.id.value('@id', 'int') as id
from @xml.nodes('/root/r') ids(id)
XML is case sensitive, so that should be
select...
October 6, 2011 at 9:26 am
kramaswamy (10/5/2011)
Row 2: From 10:11 AM to 11:28 AM. Was supposed to...
October 6, 2011 at 8:49 am
You don't need to join on Table_1 for this particular query, but that could just be an artifact of the simplified data.
In any case, you might want to group your...
October 6, 2011 at 7:54 am
Actually, if you want to return anything other than the amount--which you probably do, since you asked for details--you should look at the Row_Number() function.
Drew
October 5, 2011 at 2:50 pm
I did look at using an APPLY rather than a subquery, but the execution plans for both were essentially the same. The only difference I found was that the...
October 5, 2011 at 11:23 am
The standard way is something like the following:
SELECT DISTINCT [State]
, Stuff(
(SELECT ', ' + City
FROM Table1 AS t2
WHERE t1.[State] = t2.[State]
ORDER BY City
FOR XML PATH('')
)
, 1 -- start position
,...
October 5, 2011 at 9:54 am
For performance issues, it really helps to have the actual and/or estimated execution plans.
One thing you can try on your own is turning on XML statistics before the rest of...
October 4, 2011 at 3:36 pm
Sean Lange (10/4/2011)
October 4, 2011 at 1:14 pm
Using the distributive properties of multiplication over addition, your formula
sum(cast(l.labor as decimal(18,2)) * count(distinct d.sn) / 1000 * 23.37) as appLabor
is equivalent to the following formula
sum(cast(l.labor as decimal(18,2))) * count(distinct...
October 4, 2011 at 12:51 pm
Kenneth Fisher-475792 (10/3/2011)
October 3, 2011 at 1:32 pm
mapperhd (10/2/2011)
Thanks for the replies.However, I need to keep only the columns that are not equal.
The problem with this is that it forces you to violate the first normal form...
October 3, 2011 at 1:07 pm
Viewing 15 posts - 3,571 through 3,585 (of 4,087 total)