diff options
author | Dennis Kobert <dennis@kobert.dev> | 2021-10-10 18:03:49 +0000 |
---|---|---|
committer | Dennis Kobert <dennis@kobert.dev> | 2021-10-10 18:03:49 +0000 |
commit | cea354fc5e32667786c4a4c9f379b46b3de87ec4 (patch) | |
tree | a492a32e58b82c10b939be097821fd18d3f52a2f /sql | |
parent | a3dda94db49570f7f1e6484b49bca9196c317493 (diff) |
Change deploymentback
Diffstat (limited to 'sql')
-rw-r--r-- | sql/query.sql | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sql/query.sql b/sql/query.sql new file mode 100644 index 0000000..5582f17 --- /dev/null +++ b/sql/query.sql @@ -0,0 +1,18 @@ +WITH users AS ( + SELECT * + FROM ( VALUES ('Dennis'), ('Lam') ) AS _ (user_id) + ) + SELECT track_id, name, artist + FROM track + JOIN ( + SELECT track_id + FROM user_track + JOIN suser USING (user_id) + JOIN track USING (track_id) + JOIN lobby USING (lobby_id) + WHERE suser.user_name IN (SELECT * FROM users) + GROUP BY track_id + HAVING COUNT(track_id) = (SELECT COUNT(*) FROM users) + ORDER BY EXP(SUM(LN(score))) DESC + ) AS _ USING (track_id) + ; |