Created
January 21, 2012 03:48
-
-
Save cweagans/1651178 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
pic.nid, | |
pic.sid as "original_state", | |
pis.name as "original_state_name", | |
pic.comment_number, | |
( | |
SELECT | |
pic2.sid | |
FROM | |
project_issue_comments pic2 | |
WHERE | |
pic2.nid = 1360994 AND | |
pic2.comment_number = pic.comment_number + 1 | |
) as "new_state", | |
( | |
SELECT | |
pis2.name | |
FROM | |
project_issue_state pis2 | |
WHERE | |
pis2.sid = new_state | |
) as "new_state_name", | |
pic.timestamp | |
FROM | |
project_issue_comments pic | |
JOIN | |
project_issue_state pis ON pic.sid = pis.sid | |
WHERE | |
pic.nid = 1360994; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment