FOROS PROFESIONALES
WINDEV
,
WEBDEV
y
WINDEV Mobile
Inicio
|
Mensajes recientes
|
Conéctese...
|
Desconectar
|
Español
Inicio
→
Reports & Queries
→
Requete SQL multi colonne
Requete SQL multi colonne
Iniciado por Jean-François P, 11,abr. 2019 09:56 - 4 respuestas
Conéctese…
Jean-François P
#1
Miembro registrado
97 mensajes
Popularité : +1 (1 vote)
Publicado el 11,abril 2019 - 09:56
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
Informar
0
0
Jean-François P
#2
Miembro registrado
97 mensajes
Popularité : +1 (1 vote)
Publicado el 11,abril 2019 - 10:12
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
Informar
0
0
WindevMan
#3
Miembro registrado
2 mensajes
Publicado el 17,abril 2019 - 16:57
il suffit de faire un SUM et un GROUP BY
Informar
0
0
Britneymcdaniel
#4
Miembro registrado
5 mensajes
Publicado el 29,julio 2022 - 13:54
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.
Informar
0
0
Britneymcdaniel
#5
Miembro registrado
5 mensajes
Publicado el 30,julio 2022 - 07:24
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!
Informar
0
0
→ Volver a Reports & Queries
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (versiones precedentes)
WEBDEV (versiones precedentes)
WINDEV Mobile (versiones precedentes)
Reports & Queries
Irrelevante
Herramientas
Français
English
Español
Portuguesa
Fermer cette fenêtre
Búsqueda Tipo
Sólo temas
Todos los mensajes
Periodo Buscar
Cualquier fecha
Última hora
Última 24 horas
Última semana
Último mes
Último año
Cancelar
Vista previa del mensaje
Añadiendo una imagen
Importar una imagen desde una URL
Enviar una imagen desde un archivo de su disco
Arrastrar un archivo o click en "Examinar..."
o
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto