Skip to content

Commit

Permalink
Updated SELECT for Loans to show all
Browse files Browse the repository at this point in the history
  • Loading branch information
allisonglittle committed Dec 7, 2021
1 parent a4d55fc commit 63fecaf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library-express/create_loan.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = function () {

/*Get loan information from database*/
function getLoanDetails(res, mysql, context, complete) {
mysql.pool.query("SELECT l.loanID, CONCAT(p.firstName, ' ', p.lastName) as 'patronName', DATE_FORMAT(l.loanDate, '%m/%d/%Y') as loanDate, count(li.bookID) as 'bookCount' FROM Loans l INNER JOIN Patrons p ON l.memberID = p.memberID INNER JOIN LoanItems li on l.loanID = li.loanID GROUP BY l.loanID", function (error, results, fields) {
mysql.pool.query("SELECT l.loanID, CONCAT(p.firstName, ' ', p.lastName) as 'patronName', DATE_FORMAT(l.loanDate, '%m/%d/%Y') as loanDate, count(li.bookID) as 'bookCount' FROM Loans l INNER JOIN Patrons p ON l.memberID = p.memberID LEFT JOIN LoanItems li on l.loanID = li.loanID GROUP BY l.loanID", function (error, results, fields) {
if (error) {
res.write(JSON.stringify(error));
res.end();
Expand Down

0 comments on commit 63fecaf

Please sign in to comment.