Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion solution/1900-1999/1919.Leetcodify Similar Friends/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,15 @@ Friendship table:
<!-- 这里可写当前语言的特殊实现逻辑 -->

```sql

# Write your MySQL query statement below
SELECT DISTINCT user1_id, user2_id
FROM
Friendship AS f
LEFT JOIN Listens AS l1 ON user1_id = l1.user_id
LEFT JOIN Listens AS l2 ON user2_id = l2.user_id
WHERE l1.song_id = l2.song_id AND l1.day = l2.day
GROUP BY 1, 2, l1.day
HAVING count(DISTINCT l1.song_id) >= 3;
```

<!-- tabs:end -->
10 changes: 9 additions & 1 deletion solution/1900-1999/1919.Leetcodify Similar Friends/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,15 @@ Users 2 and 5 are friends and listened to songs 10, 11, and 12, but they did not
### **SQL**

```sql

# Write your MySQL query statement below
SELECT DISTINCT user1_id, user2_id
FROM
Friendship AS f
LEFT JOIN Listens AS l1 ON user1_id = l1.user_id
LEFT JOIN Listens AS l2 ON user2_id = l2.user_id
WHERE l1.song_id = l2.song_id AND l1.day = l2.day
GROUP BY 1, 2, l1.day
HAVING count(DISTINCT l1.song_id) >= 3;
```

<!-- tabs:end -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Write your MySQL query statement below
SELECT DISTINCT user1_id, user2_id
FROM
Friendship AS f
LEFT JOIN Listens AS l1 ON user1_id = l1.user_id
LEFT JOIN Listens AS l2 ON user2_id = l2.user_id
WHERE l1.song_id = l2.song_id AND l1.day = l2.day
GROUP BY 1, 2, l1.day
HAVING count(DISTINCT l1.song_id) >= 3;