diff --git a/src/main/kotlin/net/taehui/twilight/system/DB.kt b/src/main/kotlin/net/taehui/twilight/system/DB.kt index c84cf6a..42d7347 100644 --- a/src/main/kotlin/net/taehui/twilight/system/DB.kt +++ b/src/main/kotlin/net/taehui/twilight/system/DB.kt @@ -485,8 +485,8 @@ it.prepareStatement( """ SELECT tw_note.Note_ID - FROM tw_note LEFT OUTER JOIN tw_comment - ON tw_note.Note_ID = tw_comment.Note_ID + FROM tw_comment + LEFT OUTER JOIN tw_note USING (Note_ID) WHERE tw_comment.Note_ID IS NULL """.trimIndent() ).use { dbStatement -> @@ -2168,8 +2168,8 @@ it.prepareStatement( """ SELECT Note_ID - FROM tw_note - INNER JOIN (tw_comment) USING (Note_ID) + FROM tw_comment + INNER JOIN (tw_note) USING (Note_ID) WHERE Avatar = ? AND Is_Max = true """.trimIndent() ).use { dbStatement -> @@ -3110,8 +3110,8 @@ db.prepareStatement( """ SELECT tw_note.Note_ID, Note_ID_128, Note_ID_256, Title, Artist, Genre, Level_Text, Level, Stand - FROM tw_note - INNER JOIN tw_comment USING(Note_ID) + FROM tw_comment + INNER JOIN (tw_note) USING (Note_ID) WHERE Avatar = ? AND Is_Max = true """.trimIndent() ).use { dbStatement -> @@ -3197,8 +3197,8 @@ db.prepareStatement( """ SELECT tw_note.Note_ID, Note_ID_128, Note_ID_256, Title, Artist, Genre, Level_Text, Level, Stand - FROM tw_note - INNER JOIN tw_comment USING(Note_ID) + FROM tw_comment + INNER JOIN (tw_note) USING (Note_ID) WHERE Avatar = ? AND Is_Max = true """.trimIndent() ).use { dbStatement -> @@ -3910,8 +3910,8 @@ it.prepareStatement( """ SELECT tw_comment.Note_ID, Title, Artist, Genre, Level, Level_Text, COUNT(tw_comment.Note_ID) AS Value - FROM tw_note - INNER JOIN tw_comment USING(Note_ID) + FROM tw_comment + INNER JOIN (tw_note) USING (Note_ID) WHERE Date BETWEEN "$yyyyMM-01" AND "$yyyyMM-31" GROUP BY tw_comment.Note_ID ORDER BY Value DESC @@ -3990,8 +3990,8 @@ it.prepareStatement( """ SELECT tw_favor.Note_ID, Title, Artist, Genre, Level, Level_Text, SUM(2 * Favor - 1) AS Value - FROM tw_note - INNER JOIN tw_favor USING(Note_ID) + FROM tw_favor + INNER JOIN tw_note USING(Note_ID) GROUP BY tw_favor.Note_ID ORDER BY Value DESC LIMIT 10; @@ -4018,8 +4018,8 @@ it.prepareStatement( """ SELECT tw_favor.Note_ID, Title, Artist, Genre, Level, Level_Text, SUM(2 * Favor - 1) AS Value - FROM tw_note - INNER JOIN tw_favor USING(Note_ID) + FROM tw_favor + INNER JOIN tw_note USING(Note_ID) WHERE Date BETWEEN "$yyyyMM-01" AND "$yyyyMM-31" GROUP BY tw_favor.Note_ID ORDER BY Value DESC @@ -4047,8 +4047,8 @@ it.prepareStatement( """ SELECT Input_Mode AS Mode, COUNT(Input_Mode) AS Value - FROM tw_note - INNER JOIN tw_comment USING(Note_ID) + FROM tw_comment + INNER JOIN tw_note USING(Note_ID) GROUP BY Mode ORDER BY Value DESC """.trimIndent()