source: database/Advanced Reports for database/List of clients who haven't made an order yet.txt@ 6c7cfa6

main
Last change on this file since 6c7cfa6 was 62b2964, checked in by Klimentina Efremova <klimentina08642@…>, 2 weeks ago

Project Handcraft Marketplace

  • Property mode set to 100644
File size: 405 bytes
Line 
1CREATE OR REPLACE FUNCTION get_clients_without_orders()
2RETURNS TABLE (
3 client_id INT,
4 client_name TEXT,
5 email TEXT
6)
7LANGUAGE plpgsql
8AS $$
9BEGIN
10 RETURN QUERY
11 SELECT
12 c.client_id,
13 c.name AS client_name,
14 c.email
15 FROM client c
16 LEFT JOIN makes_order mo
17 ON c.client_id = mo.client_id
18 WHERE mo.order_num IS NULL
19 ORDER BY c.client_id;
20END;
21$$;
Note: See TracBrowser for help on using the repository browser.