-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Expand file tree
/
Copy path__sample_sp.sql
More file actions
19 lines (19 loc) · 632 Bytes
/
__sample_sp.sql
File metadata and controls
19 lines (19 loc) · 632 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- =============================================
-- Sample Stored Procedure: GetTodoListsSummary
-- This script runs on every deployment (no journaling).
-- Add your stored procedures to this folder.
-- =============================================
-- CREATE OR ALTER PROCEDURE [dbo].[GetTodoListsSummary]
-- AS
-- BEGIN
-- SET NOCOUNT ON;
-- SELECT
-- tl.Id,
-- tl.Title,
-- COUNT(ti.Id) AS ItemCount,
-- SUM(CASE WHEN ti.Done = 1 THEN 1 ELSE 0 END) AS CompletedCount
-- FROM TodoLists tl
-- LEFT JOIN TodoItems ti ON ti.ListId = tl.Id
-- GROUP BY tl.Id, tl.Title;
-- END
-- GO