-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPLAYLISTS_SELECT.sql
More file actions
25 lines (24 loc) · 980 Bytes
/
PLAYLISTS_SELECT.sql
File metadata and controls
25 lines (24 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
-------------------------------------------------------------------------------------------------
-- VIDEOS_SELECT
-------------------------------------------------------------------------------------------------
SET NOCOUNT ON;
SET ANSI_NULLS ON;
SET QUOTED_IDENTIFIER ON;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
-------------------------------------------------------------------------------------------------
USE VideoHosting;
IF NOT EXISTS (SELECT 1 FROM [sys].[tables] WHERE [name] = N'PLAYLISTS') BEGIN
PRINT N'❌ TABLE [VIDEOS] WAS NOT FOUND';
END ELSE BEGIN
SELECT
[PLAYLIST].[UID],
[PLAYLIST].[TITLE],
[PLAYLIST].[DESCRIPTION],
[USER].[USERNAME] [USER],
[ACCESS].[TITLE] [ACCESS],
[PLAYLIST].[CREATED_DT]
FROM [PLAYLISTS] [PLAYLIST]
LEFT JOIN [USERS] [USER] ON [PLAYLIST].[USER_UID]=[USER].[UID]
LEFT JOIN [ACCESS_LEVELS] [ACCESS] ON [PLAYLIST].[ACCESS_UID]=[ACCESS].[UID]
ORDER BY [PLAYLIST].[USER_UID];
END;