Get column value if it matches another column value in the same table
问题 I have a SQLite table with comments like: Id | replyId | commentID_parentID | usernameChannelId | channelId 1 | NULL | NULL | a | g 2 | NULL | NULL | b | k NULL | 1.k | 1 | a | p NULL | 1.p | 1 | c | i 3 | NULL | NULL | d | h NULL | 2.k | 2 | g | g and a table with channels like: I want to know which user (userChannelId) replied to which user. So I take a row with a comment and check if: Id == NULL? Then it's a reply -> get userChannelId where commentID_parentID == Id Id != NULL? Then it's a