Viewing 15 posts - 2,431 through 2,445 (of 59,098 total)
But, you DO have a UNIQUE set of column keys based on Entity, Attribute, and StartDate.
This looks suspiciously like a column based audit table or Slowly Changing Dimension format. Is...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 25, 2022 at 3:34 am
I don't know your database but I'd take advantage of this as an opportunity to improve. I'd move my two to four largest fragmenting clustered indexes each to their own...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 25, 2022 at 3:29 am
You can substitute this simple GREATEST with a CASE WHEN THEN END statement.
Since GREATEST isn't available in 2019, you should post that change to the code for the OP....
--Jeff Moden
Change is inevitable... Change for the better is not.
November 25, 2022 at 2:56 am
Thanks a lot!
For what?
--Jeff Moden
Change is inevitable... Change for the better is not.
November 25, 2022 at 1:15 am
Shifting gears back to the problem, is there a UNIQUE column in the table to identify individual rows with?
--Jeff Moden
Change is inevitable... Change for the better is not.
November 23, 2022 at 7:49 pm
Thank you both for replying. I apologize for my delayed response, I though I would get an email when follow-ups were posted.
You thought correctly except that functionality was broken...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 23, 2022 at 7:40 pm
SELECT StudentId
FROM @student
GROUP BY ...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 23, 2022 at 7:28 pm
@Raja mssql ,
This is meant as a friendly but serious suggestion... IF you even think that you're experiencing "SQL Injection" and YOU are asking these types of questions on a...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 23, 2022 at 3:28 pm
p.s. This would make a great DA whiteboard interview question... if the candidate only comes up with the solution to the exact problem, you might want to consider someone else....
--Jeff Moden
Change is inevitable... Change for the better is not.
November 23, 2022 at 2:53 pm
Just in case anyone wonders what I'm going on about, the original question is a "data analysis" question.
Yep. It can be solved without using a series of dates (and Peter's...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 23, 2022 at 2:51 pm
-- swePeso solution
WITH cteData(StudentId, delta, rnk)
AS (
SELECT StudentId,
...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 23, 2022 at 2:19 pm
jignesh209 ,
Jeffrey must've gotten busy. Apologies for the delay. Here's the code that will answer the question that you asked.
SELECT StudentId
FROM #Student
...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 23, 2022 at 2:20 am
Ok, Jeffrey... the Op posted some good test data. I'll give you the honors for providing the solution.
--Jeff Moden
Change is inevitable... Change for the better is not.
November 23, 2022 at 1:42 am
Yeah, but in the actual question the OP asks for those students that turned in the assignment for all dates.
Sorry... I was in the process of changing my reply...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 23, 2022 at 1:35 am
But to just identify the students that did submit on every day - all you need is the number of days to match. Any student that has a...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 23, 2022 at 12:48 am
Viewing 15 posts - 2,431 through 2,445 (of 59,098 total)