Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nice SQL usage #40

Closed
tloth opened this issue Aug 9, 2019 · 0 comments

Comments

@tloth
Copy link

commented Aug 9, 2019

const getAllScores = cb => {
databaseConnection.query(`SELECT users.name, SUM(inventory.item_power)
FROM users
INNER JOIN ownership
ON users.id = ownership.owner_id
INNER JOIN inventory
ON inventory.id = ownership.item_id
GROUP BY users.id`, (err, res) => {
if (err) cb(err)
else {
cb(null, res.rows);
}
})
}

alex approves

@tonylomax tonylomax closed this Aug 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.