Viewing 15 posts - 3,511 through 3,525 (of 4,087 total)
Dan Williams-449672 (11/8/2011)
any ideas or am i heading down the wrong road?
You're definitely headed down the wrong road, but without easily consumable sample data and expected results, you're unlikely to...
November 8, 2011 at 9:08 am
You're probably running into problems, because the standard way to do beginning of time period calculations is to use date 0 ('1900-01-01') as the foundation of the calculations. This...
November 8, 2011 at 8:26 am
The subquery is unnecessary. You can write this as follows:
SELECT iStudentid as StudentId, OldClassID, NewClassID
FROM @tblMoveStudentList as StudentMoveSummary
FOR XML auto,ROOT('ArrayOfStudentMoveSummary'),ELEMENTS
If you alias the table, it will use that alias...
November 4, 2011 at 3:05 pm
ColdCoffee (11/3/2011)
DECLARE @MaxIDoFMaxPrice INT
; WITH RowWithMaxValue AS
(
SELECT TOP 1 ID
FROM @Table
ORDER BY PRICE DESC
)
SELECT @MaxIDoFMaxPrice = ID FROM RowWithMaxValue
SELECT * FROM @Table
ORDER BY CASE WHEN ID =...
November 4, 2011 at 1:23 pm
Welsh Corgi (11/2/2011)
I'm on 2 months back but I don't have the Date Ending down on all but a few, e.x. '2011-11-30 23:59:59.000'
You are potentially missing some records like '2011-11-30...
November 2, 2011 at 2:02 pm
GSquared (11/2/2011)
O.RecID being null doesn't necessarily mean a missing row. Might, but could also just be a nullable columns in the table.
Not by itself, but the fact that it's...
November 2, 2011 at 1:21 pm
Sean Lange (11/2/2011)
However, just in the skeleton you posted you can increase performance AND accuracy to at least some degree...
November 2, 2011 at 12:30 pm
getusama-1105611 (11/2/2011)
Msg 157, Level 15, State 1, Line 100
An aggregate may not appear in the set list of an UPDATE statement.
This is the...
November 2, 2011 at 12:06 pm
Since windowed functions (like Row_Number) can't be used directly in an UPDATE statement, you'll need to use a CTE. Otherwise, you have everything that you need to solve this...
November 2, 2011 at 11:31 am
ROW_NUMBER() partitioned by your group will give you the results that you want. If you want tested code, provide the sample data and results that Phil asked for.
Drew
November 2, 2011 at 9:56 am
Sean Lange (11/1/2011)
November 1, 2011 at 3:08 pm
ramanamreddy (11/1/2011)
November 1, 2011 at 2:01 pm
ramanamreddy (11/1/2011)
I don't need any average or sum, I can use it in the query if I want but not in the output,.,.,
Even though it doesn't look like it, you...
November 1, 2011 at 1:43 pm
You would just use your CASE expression for your PARTITION BY expression.
SELECT Rank() Over( PARTITION BY CASE WHEN ... THEN ... END ORDER BY expression )
FROM YourTable
Drew
November 1, 2011 at 7:06 am
Here is a shot in the dark at a solution.
;
WITH Totals_Ranked AS (
SELECT *, Row_Number() OVER (PARTITION BY m10_Class_Code ORDER BY Month_Start DESC) AS Month_Rank
, Row_Number() OVER ( PARTITION BY...
October 28, 2011 at 10:05 am
Viewing 15 posts - 3,511 through 3,525 (of 4,087 total)