Viewing 15 posts - 2,671 through 2,685 (of 4,085 total)
Although, if you are eventually going to "pivot" the data, it's probably better to use the ROW_NUMBER and skip the LAG/LEAD.
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 16, 2016 at 1:29 pm
J Livingston SQL (5/15/2016)
WITH cteprices as (
SELECT itmId,
price,
ROW_NUMBER() OVER(PARTITION BY...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 16, 2016 at 12:56 pm
leon_clf (5/16/2016)
drew.allen (5/16/2016)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 16, 2016 at 10:49 am
This is usually done with a CTE with ROW_NUMBER(). I'm showing the equivalent derived table version, since your original query used derived tables rather than CTEs.
I've also assigned your...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 16, 2016 at 10:37 am
sqlnaive (5/16/2016)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 16, 2016 at 9:16 am
You haven't given your desired output, but it looks like you can get what you want by simply using the nodes() function on the subtrees received from the first nodes()...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 16, 2016 at 8:55 am
For performance problems, please post the execution plan (actual if possible, estimated if not), and the stored proc definition. Given that your error handling consists of a single simple...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 16, 2016 at 8:37 am
copling (5/13/2016)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 13, 2016 at 2:26 pm
ChrisM@Work (5/13/2016)
;WITH
CTE1 AS (
SELECT [Emp_no.], Org_Code, Org_Num FROM #Employee
EXCEPT
SELECT [Emp_no.], Org_Code, Org_Num FROM #Class
), CTE2 AS (
SELECT [Emp_no.], Org_Code, Org_Num FROM #Class
EXCEPT
SELECT [Emp_no.],...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 13, 2016 at 12:15 pm
You can't directly convert an INT to a DATE. You could either convert an INT to DATETIME and then to DATE or you could use DATEADD(DAY, <your int field>,...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 13, 2016 at 12:02 pm
b.grove (5/12/2016)
The range of revisions are from 1 to 27. Some people have 1. Some have 5....
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 13, 2016 at 7:58 am
Eric M Russell (5/12/2016)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 12, 2016 at 2:34 pm
TheSQLGuru (5/11/2016)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 12, 2016 at 7:56 am
Alan.B (5/11/2016)
drew.allen (5/11/2016)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 11, 2016 at 3:59 pm
It looks like he wants to sort by the root process. He has an adjacency list of processes and blocking processes. Take a look at the following article...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
May 11, 2016 at 3:13 pm
Viewing 15 posts - 2,671 through 2,685 (of 4,085 total)