Oracle sql
Résolu/Fermé
pacman77
-
11 déc. 2007 à 11:36
phil232 Messages postés 607 Date d'inscription mardi 25 septembre 2007 Statut Membre Dernière intervention 31 janvier 2008 - 11 déc. 2007 à 16:09
phil232 Messages postés 607 Date d'inscription mardi 25 septembre 2007 Statut Membre Dernière intervention 31 janvier 2008 - 11 déc. 2007 à 16:09
A voir également:
- Oracle sql
- Sql server recovery - Télécharger - Gestion de données
- Identificateur non valide oracle ✓ - Forum Bases de données
- Logiciel sql - Télécharger - Bases de données
- Requête sql date supérieure à ✓ - Forum Programmation
- Sql replace plusieurs valeurs - Forum Programmation
3 réponses
phil232
Messages postés
607
Date d'inscription
mardi 25 septembre 2007
Statut
Membre
Dernière intervention
31 janvier 2008
178
11 déc. 2007 à 14:17
11 déc. 2007 à 14:17
peut-tu essayer ça :
select distinct c.name as "name",
s.total as "1st",
NULL as "2nd",
NULL as "3rd",
NULL as "4th"
from customer c, INNER JOIN sales_order s ON c.customer_id=s.customer_id
WHERE to_char(s.order_date, 'Q')=1
UNION
select distinct c.name as "name",
NULL as "1st",
s.total as "2nd",
NULL as "3rd",
NULL as "4th"
from customer c, INNER JOIN sales_order s ON c.customer_id=s.customer_id
WHERE to_char(s.order_date, 'Q')=2
UNION
select distinct c.name as "name",
NULL as "1st",
NULL as "2nd",
s.total as "3rd",
NULL as "4th"
from customer c, INNER JOIN sales_order s ON c.customer_id=s.customer_id
WHERE to_char(s.order_date, 'Q')=3
UNION
select distinct c.name as "name",
NULL as "1st",
NULL as "2nd",
NULL as "3rd",
s.total as "4th"
from customer c, INNER JOIN sales_order s ON c.customer_id=s.customer_id
WHERE to_char(s.order_date, 'Q')=4
select distinct c.name as "name",
s.total as "1st",
NULL as "2nd",
NULL as "3rd",
NULL as "4th"
from customer c, INNER JOIN sales_order s ON c.customer_id=s.customer_id
WHERE to_char(s.order_date, 'Q')=1
UNION
select distinct c.name as "name",
NULL as "1st",
s.total as "2nd",
NULL as "3rd",
NULL as "4th"
from customer c, INNER JOIN sales_order s ON c.customer_id=s.customer_id
WHERE to_char(s.order_date, 'Q')=2
UNION
select distinct c.name as "name",
NULL as "1st",
NULL as "2nd",
s.total as "3rd",
NULL as "4th"
from customer c, INNER JOIN sales_order s ON c.customer_id=s.customer_id
WHERE to_char(s.order_date, 'Q')=3
UNION
select distinct c.name as "name",
NULL as "1st",
NULL as "2nd",
NULL as "3rd",
s.total as "4th"
from customer c, INNER JOIN sales_order s ON c.customer_id=s.customer_id
WHERE to_char(s.order_date, 'Q')=4
phil232
Messages postés
607
Date d'inscription
mardi 25 septembre 2007
Statut
Membre
Dernière intervention
31 janvier 2008
178
11 déc. 2007 à 16:09
11 déc. 2007 à 16:09
tu peut le reécrire avec un WHERE pourquoi pas ?
il m'a fallu qq années mais maintenant je ne veux plus changer
il m'a fallu qq années mais maintenant je ne veux plus changer