Viewing 15 posts - 1,696 through 1,710 (of 3,489 total)
Maybe a ForEach table loop and a LEFT OUTER JOIN?
November 23, 2016 at 5:10 pm
If you split the Date and Time fields into two different columns in SQL Server, then this query is trivial.
November 23, 2016 at 2:03 pm
Don't understand why you think you need windowing functions...
Does this do what you want? The inner query, inside the parentheses... query "x", gets the counts for each grouping, and then...
November 23, 2016 at 1:37 pm
Self-joins with aggregates. YUCK.
How about something really simple... maybe like this?
SELECT PatientID
, SessionID
, SessionTime
, LAG([SessionTime]) OVER (PARTITION BY PatientID ORDER BY SessionTime) AS PrevSession
FROM
(SELECT 1 AS PatientID, 1 AS SessionID,...
November 21, 2016 at 6:02 pm
Well, you can't turn columns into rows from that... there's nothing to pivot on.
November 21, 2016 at 3:32 pm
Can you please explain the logic of how to get the result you're looking for? Maybe I'm slow, but that part baffles me. Maybe there's something you understand about the...
November 21, 2016 at 2:56 pm
Are there tables with the data in it somewhere that you could share? From your sample data, it's not entirely clear which columns belong in which logical group (table).
1234...
November 21, 2016 at 12:34 pm
Short answer is that it's a cross join of the first 3 columns (all possible combinations) and then outer join back to the original table to pick up the nulls...
November 21, 2016 at 9:47 am
Either you have something wrong in your data or T2 is irrelevant to the question.
Here's my solution with the sample data included. Note that the second table you provide is...
November 19, 2016 at 4:57 pm
Viewing 15 posts - 1,696 through 1,710 (of 3,489 total)