GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEV
,
WEBDEV
e
WINDEV Mobile
Inicio
|
Mensagens recentes
|
Conecte-se...
|
Disconnect
|
Português
Inicio
→
Reports & Queries
→
Requete SQL multi colonne
Requete SQL multi colonne
Iniciado por Jean-François P, abr., 11 2019 9:56 AM - 4 respostas
Conecte-se…
Jean-François P
#1
Membro registado
97 mensagems
Popularité : +1 (1 vote)
Publicado em abril, 11 2019 - 9:56 AM
Bonjour,
Je suis assez novice en sql et je voulais savoir si il est possible de sommer deux colonnes en fonctions de deux autres colonnes.
Je m'explique :
J'ai ma BDD avec mes 5 colonnes
- Date
- Mode de paiement 1
- Mode de paiement 2
- Montant paiement 1
- Montant paiement 2
Est il possible de faire une somme des paiements en fonction du mode de paiement et de la date?
Bien cordialement
Jef
Denunciar
0
0
Jean-François P
#2
Membro registado
97 mensagems
Popularité : +1 (1 vote)
Publicado em abril, 11 2019 - 10:12 AM
Exemple :
Date | Mode de paiement 1 | Mode de paiement 2 | Montant paiement 1 | Montant paiement 2
01/02/2019 | Espèce | Chèque | 2€ | 2€
01/02/2019 | Chèque | CB | 4€ | 4€
02/02/2019 | CB | Espèce | 6€ | 6€
02/02/2019 | Espèce | CB | 2€ | 2€
03/02/2019 | CB | Chèque | 4€ | 4€
03/02/2019 | Chèque | Espèce | 6€ | 6€
Le résultat serait :
01/02/2019 | Espèce | 2€
01/02/2019 | Chèque | 6€
01/02/2019 | CB | 4€
02/02/2019 | Espèce | 8€
02/02/2019 | Chèque | 0€
02/02/2019 | CB | 8€
03/02/2019 | Espèce | 6€
03/02/2019 | Chèque | 10€
03/02/2019 | CB | 4€
Je sèche vraiment, merci de votre aide.
Bien cordialement
Jef
Denunciar
0
0
WindevMan
#3
Membro registado
2 mensagems
Publicado em abril, 17 2019 - 4:57 PM
il suffit de faire un SUM et un GROUP BY
Denunciar
0
0
Britneymcdaniel
#4
Membro registado
5 mensagems
Publicado em julho, 29 2022 - 1:54 PM
I think You have to try this:
UPDATE table1
SET a = t2.a, b = t2.b, .......
FROM table2 t2
WHERE table1.id = t2.id
That should work in most SQL dialects, excluding Oracle.
And yes - it's a lot of typing - it's the way SQL does this.
Denunciar
0
0
Britneymcdaniel
#5
Membro registado
5 mensagems
Publicado em julho, 30 2022 - 7:24 AM
Britneymcdaniel escribió:
I think You have to try this:
https://www.kohlsfeedback.onl/
UPDATE table1
SET a = t2.a, b = t2.b, .......
FROM table2 t2
WHERE table1.id = t2.id
That should work in most SQL dialects, excluding Oracle.
And yes - it's a lot of typing - it's the way SQL does this.
In the real world, you will often want to select multiple columns. Luckily, SQL makes this really easy. To select multiple columns from a table, simply separate the column names with commas!
Denunciar
0
0
→ Voltar para Reports & Queries
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (versões anteriores)
WEBDEV (versões anteriores)
WINDEV Mobile (versões anteriores)
Reports & Queries
Off-topic
Ferramentas
Français
English
Español
Portuguesa
Fermer cette fenêtre
Tipo de Pesquisa
Apenas tópicos
Todas as mensagens
Período de pesquisa
Qualquer momento
Última hora
Últimas 24 horas
Semana passada
Mês passado
Ano passado
Cancelar
Pré-visualização da sua mensagem
Adicionar imagem
Importar uma imagem de uma URL
Enviar uma imagem a partir do seu disco
Deixe um ficheiro ou clique em "Procurar ..."
ou
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto