Viewing 15 posts - 3,511 through 3,525 (of 4,085 total)
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...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
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 =...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
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...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
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...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
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...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
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...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
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...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
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
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 2, 2011 at 9:56 am
Sean Lange (11/1/2011)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 1, 2011 at 3:08 pm
ramanamreddy (11/1/2011)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
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...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
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
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
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...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 28, 2011 at 10:05 am
It wasn't chastisement, it's realism. You have to understand that everyone here is a volunteer. The more hurdles you place in front of people, the fewer will even...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 28, 2011 at 9:27 am
First, the idea behind including a SAMPLE is that it is large enough to provide a realistic representation of the data, BUT NO LARGER. Since you are grouping on...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 28, 2011 at 8:47 am
Viewing 15 posts - 3,511 through 3,525 (of 4,085 total)