Changes between Version 16 and Version 17 of Напредни извештаи од базата (SQL и складирани процедури)


Ignore:
Timestamp:
01/12/25 16:46:25 (3 days ago)
Author:
222039
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Напредни извештаи од базата (SQL и складирани процедури)

    v16 v17  
    116116}}}
    117117
     118=== Извештај за членовите ===
     119{{{#!sql
     120SELECT
     121    u.FirstName,
     122    u.LastName,
     123    COUNT(l.LoanID) as total_loans,
     124    COUNT(f.FineID) as total_fines,
     125    SUM(f.FineAmount) as total_fine_amount
     126FROM Users u
     127JOIN Member m ON u.UserID = m.UserID
     128LEFT JOIN Loan l ON m.MemberID = l.MemberID
     129LEFT JOIN Fine f ON l.LoanID = f.LoanID
     130GROUP BY u.UserID, u.FirstName, u.LastName
     131ORDER BY total_loans DESC;
     132}}}