Comments
-
@GrantSmith That's exactly what I need. Thank you!
-
SELECT *, CASE WHEN `userID` IS NULL THEN (SELECT DISTINCT `userID` FROM `your_table` WHERE (`sessionID`=T.`sessionID`) AND (`userID` IS NOT NULL)) ELSE `userID` END AS "new_UserID" FROM `your_table` T If I understood correctly, this should work. Hope it helps!
-
Thank you @MarkSnodgrass !
-
@GrantSmith Thank you so much! It worked using SUM(SUM(..)) OVER (ORDER BY ..)