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

SUM with IF #36

Open
reklin7jc opened this issue Jun 10, 2020 · 0 comments
Open

SUM with IF #36

reklin7jc opened this issue Jun 10, 2020 · 0 comments

Comments

@reklin7jc
Copy link

reklin7jc commented Jun 10, 2020

how would this consultation with the hydrahon be?

SUM(+1) as matches,
SUM(IF((matches.playerblue = '.$idPlayer.' AND matches.rtb > matches.rtr) OR (matches.playerred = '.$idPlayer.' AND matches.rtr > matches.rtb), 1, 0)) as victories,
SUM(IF((matches.playerblue = '.$idPlayer.' AND matches.rtb < matches.rtr) OR (matches.playerred = '.$idPlayer.' AND matches.rtr < matches.rtb), 1, 0)) as defeats,
SUM(IF((matches.playerblue = '.$idPlayer.' AND matches.rtb = matches.rtr) OR (matches.playerred = '.$idPlayer.' AND matches.rtr = matches.rtb), 1, 0)) as drowns,
SUM(IF(matches.playerblue = '.$idPlayer.', matches.rtb, 0) + IF(matches.playerred = '.$idPlayer.' , matches.rtr, 0)) as goalscored,
SUM(IF(matches.playerblue = '.$idPlayer.', matches.rtr, 0) + IF(matches.playerred = '.$idPlayer.' , matches.rtb, 0)) as concededgoals,
WHERE matches.playerblue = '.$idPlayer.' OR matches.playerred = '.$idPlayer.'
LIMIT '.$games

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant