我有两张桌子
表verkoper
表bestellingen
我的查询:
---
- hosts: localhost
gather_facts: no
vars:
git_ssh_public_key: "Your public ssh key"
git_ssh_key: |
-----BEGIN RSA PRIVATE KEY-----
.... actual key here ....
-----END RSA PRIVATE KEY-----
tasks:
- name: Copy SSH public key file
copy:
content: "{{ git_ssh_public_key }}"
dest: /root/.ssh/id_rsa.pub
mode: 0644
- name: Copy SSH private key file
copy:
content: "{{ git_ssh_key }}"
#src: id_rsa
dest: /root/.ssh/id_rsa
mode: 0600
- name: Get new source from GIT
git:
repo: "git@gitlab.com:user/repo.git"
dest: "/var/www/"
depth: 1
accept_hostkey: yes
clone: yes
它给了我错误 SELECT v.naam,
SUM(COUNT(b.status) * 1.50)
FROM verkoper AS v INNER JOIN
bestellingen AS b ON b.verkoper = v.id
WHERE b.status = 'retour'
GROUP BY b.verkoper
有人有想法吗?
答案 0 :(得分:2)
我认为这可能是你想要的:
SELECT v.naam, COUNT(*)*1.50
FROM verkoper v INNER JOIN
bestellingen b
ON b.verkoper = v.id
WHERE b.status = 'retour'
GROUP BY v.naam;
注意:
GROUP BY
键应与查询中的未聚合列匹配。COUNT(*)
或COUNT(1)
计算所有行数。输入更简单。COUNT()
嵌入SUM()
。