Bonsoir à tous !
Voici mon problème du jour ;-)
J'ai une table 'T_matériel', dans laquelle existe un champ
'Date_perception' , dont voici une idée du contenu:
01/1998
01/1995
09/2003
09/2003
10/2002
01/2000
01/2003
01/2002
01/1997
01/2001
09/2003
09/2003
09/2003
10/2002
10/2004
09/2002
10/2004
10/2004
01/1999
09/2001
09/2003
10/2002
10/2002
10/2004
09/2003
Le résultat que je souhaiterais obtenir est le suivant:
2005 2004 2003 2002 2001 2000 -de 2000
0 4 8 6 2 1 4
Voici ce que j'ai pensé faire comme requête, mais qui malheureusement ne
fonctionne pas, car pour les 2 champs, j'obtiens la même valeur :
SELECT count(a.Date_perception) AS 2005, count(b.Date_perception) AS 2004
FROM T_matériel a, T_matériel b
WHERE a.Date_perception LIKE '*2005'
AND b.Date_perception LIKE '*2004'
Auriez vous une idée ?
Merci d'avance !
DNI.
Bonsoir à tous !
Voici mon problème du jour ;-)
J'ai une table 'T_matériel', dans laquelle existe un champ
'Date_perception' , dont voici une idée du contenu:
01/1998
01/1995
09/2003
09/2003
10/2002
01/2000
01/2003
01/2002
01/1997
01/2001
09/2003
09/2003
09/2003
10/2002
10/2004
09/2002
10/2004
10/2004
01/1999
09/2001
09/2003
10/2002
10/2002
10/2004
09/2003
Le résultat que je souhaiterais obtenir est le suivant:
2005 2004 2003 2002 2001 2000 -de 2000
0 4 8 6 2 1 4
Voici ce que j'ai pensé faire comme requête, mais qui malheureusement ne
fonctionne pas, car pour les 2 champs, j'obtiens la même valeur :
SELECT count(a.Date_perception) AS 2005, count(b.Date_perception) AS 2004
FROM T_matériel a, T_matériel b
WHERE a.Date_perception LIKE '*2005'
AND b.Date_perception LIKE '*2004'
Auriez vous une idée ?
Merci d'avance !
DNI.
Bonsoir à tous !
Voici mon problème du jour ;-)
J'ai une table 'T_matériel', dans laquelle existe un champ
'Date_perception' , dont voici une idée du contenu:
01/1998
01/1995
09/2003
09/2003
10/2002
01/2000
01/2003
01/2002
01/1997
01/2001
09/2003
09/2003
09/2003
10/2002
10/2004
09/2002
10/2004
10/2004
01/1999
09/2001
09/2003
10/2002
10/2002
10/2004
09/2003
Le résultat que je souhaiterais obtenir est le suivant:
2005 2004 2003 2002 2001 2000 -de 2000
0 4 8 6 2 1 4
Voici ce que j'ai pensé faire comme requête, mais qui malheureusement ne
fonctionne pas, car pour les 2 champs, j'obtiens la même valeur :
SELECT count(a.Date_perception) AS 2005, count(b.Date_perception) AS 2004
FROM T_matériel a, T_matériel b
WHERE a.Date_perception LIKE '*2005'
AND b.Date_perception LIKE '*2004'
Auriez vous une idée ?
Merci d'avance !
DNI.
Bonsoir à tous !
Voici mon problème du jour ;-)
J'ai une table 'T_matériel', dans laquelle existe un champ
'Date_perception'
, dont voici une idée du contenu:
01/1998
01/1995
09/2003
09/2003
10/2002
01/2000
01/2003
01/2002
01/1997
01/2001
09/2003
09/2003
09/2003
10/2002
10/2004
09/2002
10/2004
10/2004
01/1999
09/2001
09/2003
10/2002
10/2002
10/2004
09/2003
Le résultat que je souhaiterais obtenir est le suivant:
2005 2004 2003 2002 2001 2000 -de 2000
0 4 8 6 2 1 4
Voici ce que j'ai pensé faire comme requête, mais qui malheureusement ne
fonctionne pas, car pour les 2 champs, j'obtiens la même valeur :
SELECT count(a.Date_perception) AS 2005, count(b.Date_perception) AS 2004
FROM T_matériel a, T_matériel b
WHERE a.Date_perception LIKE '*2005'
AND b.Date_perception LIKE '*2004'
Auriez vous une idée ?
Merci d'avance !
DNI.
Bonsoir à tous !
Voici mon problème du jour ;-)
J'ai une table 'T_matériel', dans laquelle existe un champ
'Date_perception'
, dont voici une idée du contenu:
01/1998
01/1995
09/2003
09/2003
10/2002
01/2000
01/2003
01/2002
01/1997
01/2001
09/2003
09/2003
09/2003
10/2002
10/2004
09/2002
10/2004
10/2004
01/1999
09/2001
09/2003
10/2002
10/2002
10/2004
09/2003
Le résultat que je souhaiterais obtenir est le suivant:
2005 2004 2003 2002 2001 2000 -de 2000
0 4 8 6 2 1 4
Voici ce que j'ai pensé faire comme requête, mais qui malheureusement ne
fonctionne pas, car pour les 2 champs, j'obtiens la même valeur :
SELECT count(a.Date_perception) AS 2005, count(b.Date_perception) AS 2004
FROM T_matériel a, T_matériel b
WHERE a.Date_perception LIKE '*2005'
AND b.Date_perception LIKE '*2004'
Auriez vous une idée ?
Merci d'avance !
DNI.
Bonsoir à tous !
Voici mon problème du jour ;-)
J'ai une table 'T_matériel', dans laquelle existe un champ
'Date_perception'
, dont voici une idée du contenu:
01/1998
01/1995
09/2003
09/2003
10/2002
01/2000
01/2003
01/2002
01/1997
01/2001
09/2003
09/2003
09/2003
10/2002
10/2004
09/2002
10/2004
10/2004
01/1999
09/2001
09/2003
10/2002
10/2002
10/2004
09/2003
Le résultat que je souhaiterais obtenir est le suivant:
2005 2004 2003 2002 2001 2000 -de 2000
0 4 8 6 2 1 4
Voici ce que j'ai pensé faire comme requête, mais qui malheureusement ne
fonctionne pas, car pour les 2 champs, j'obtiens la même valeur :
SELECT count(a.Date_perception) AS 2005, count(b.Date_perception) AS 2004
FROM T_matériel a, T_matériel b
WHERE a.Date_perception LIKE '*2005'
AND b.Date_perception LIKE '*2004'
Auriez vous une idée ?
Merci d'avance !
DNI.
Bonsoir à tous !
Voici mon problème du jour ;-)
J'ai une table 'T_matériel', dans laquelle existe un champ 'Date_perception'
, dont voici une idée du contenu:
01/1998
01/1995
09/2003
09/2003
10/2002
01/2000
01/2003
01/2002
01/1997
01/2001
09/2003
09/2003
09/2003
10/2002
10/2004
09/2002
10/2004
10/2004
01/1999
09/2001
09/2003
10/2002
10/2002
10/2004
09/2003
Le résultat que je souhaiterais obtenir est le suivant:
2005 2004 2003 2002 2001 2000 -de 2000
0 4 8 6 2 1 4
Voici ce que j'ai pensé faire comme requête, mais qui malheureusement ne
fonctionne pas, car pour les 2 champs, j'obtiens la même valeur :
SELECT count(a.Date_perception) AS 2005, count(b.Date_perception) AS 2004
FROM T_matériel a, T_matériel b
WHERE a.Date_perception LIKE '*2005'
AND b.Date_perception LIKE '*2004'
Auriez vous une idée ?
Merci d'avance !
DNI.
Bonsoir à tous !
Voici mon problème du jour ;-)
J'ai une table 'T_matériel', dans laquelle existe un champ 'Date_perception'
, dont voici une idée du contenu:
01/1998
01/1995
09/2003
09/2003
10/2002
01/2000
01/2003
01/2002
01/1997
01/2001
09/2003
09/2003
09/2003
10/2002
10/2004
09/2002
10/2004
10/2004
01/1999
09/2001
09/2003
10/2002
10/2002
10/2004
09/2003
Le résultat que je souhaiterais obtenir est le suivant:
2005 2004 2003 2002 2001 2000 -de 2000
0 4 8 6 2 1 4
Voici ce que j'ai pensé faire comme requête, mais qui malheureusement ne
fonctionne pas, car pour les 2 champs, j'obtiens la même valeur :
SELECT count(a.Date_perception) AS 2005, count(b.Date_perception) AS 2004
FROM T_matériel a, T_matériel b
WHERE a.Date_perception LIKE '*2005'
AND b.Date_perception LIKE '*2004'
Auriez vous une idée ?
Merci d'avance !
DNI.
Bonsoir à tous !
Voici mon problème du jour ;-)
J'ai une table 'T_matériel', dans laquelle existe un champ 'Date_perception'
, dont voici une idée du contenu:
01/1998
01/1995
09/2003
09/2003
10/2002
01/2000
01/2003
01/2002
01/1997
01/2001
09/2003
09/2003
09/2003
10/2002
10/2004
09/2002
10/2004
10/2004
01/1999
09/2001
09/2003
10/2002
10/2002
10/2004
09/2003
Le résultat que je souhaiterais obtenir est le suivant:
2005 2004 2003 2002 2001 2000 -de 2000
0 4 8 6 2 1 4
Voici ce que j'ai pensé faire comme requête, mais qui malheureusement ne
fonctionne pas, car pour les 2 champs, j'obtiens la même valeur :
SELECT count(a.Date_perception) AS 2005, count(b.Date_perception) AS 2004
FROM T_matériel a, T_matériel b
WHERE a.Date_perception LIKE '*2005'
AND b.Date_perception LIKE '*2004'
Auriez vous une idée ?
Merci d'avance !
DNI.
Bonjour Denis
Tu peux faire un essai avec le code suivant
SELECT Year([Date_perception]) AS Année, Count(T_materiel.Date_perception)
AS CompteDeDate_perception
FROM T_materiel
GROUP BY Year([Date_perception]);
rené
"Denis" a écrit dans le message de
news:42693396$0$5674$Bonsoir à tous !
Voici mon problème du jour ;-)
J'ai une table 'T_matériel', dans laquelle existe un champ
'Date_perception', dont voici une idée du contenu:
01/1998
01/1995
09/2003
09/2003
10/2002
01/2000
01/2003
01/2002
01/1997
01/2001
09/2003
09/2003
09/2003
10/2002
10/2004
09/2002
10/2004
10/2004
01/1999
09/2001
09/2003
10/2002
10/2002
10/2004
09/2003
Le résultat que je souhaiterais obtenir est le suivant:
2005 2004 2003 2002 2001 2000 -de 2000
0 4 8 6 2 1 4
Voici ce que j'ai pensé faire comme requête, mais qui malheureusement ne
fonctionne pas, car pour les 2 champs, j'obtiens la même valeur :
SELECT count(a.Date_perception) AS 2005, count(b.Date_perception) AS 2004
FROM T_matériel a, T_matériel b
WHERE a.Date_perception LIKE '*2005'
AND b.Date_perception LIKE '*2004'
Auriez vous une idée ?
Merci d'avance !
DNI.
Bonjour Denis
Tu peux faire un essai avec le code suivant
SELECT Year([Date_perception]) AS Année, Count(T_materiel.Date_perception)
AS CompteDeDate_perception
FROM T_materiel
GROUP BY Year([Date_perception]);
rené
"Denis" <dninews@free.fr> a écrit dans le message de
news:42693396$0$5674$626a14ce@news.free.fr...
Bonsoir à tous !
Voici mon problème du jour ;-)
J'ai une table 'T_matériel', dans laquelle existe un champ
'Date_perception'
, dont voici une idée du contenu:
01/1998
01/1995
09/2003
09/2003
10/2002
01/2000
01/2003
01/2002
01/1997
01/2001
09/2003
09/2003
09/2003
10/2002
10/2004
09/2002
10/2004
10/2004
01/1999
09/2001
09/2003
10/2002
10/2002
10/2004
09/2003
Le résultat que je souhaiterais obtenir est le suivant:
2005 2004 2003 2002 2001 2000 -de 2000
0 4 8 6 2 1 4
Voici ce que j'ai pensé faire comme requête, mais qui malheureusement ne
fonctionne pas, car pour les 2 champs, j'obtiens la même valeur :
SELECT count(a.Date_perception) AS 2005, count(b.Date_perception) AS 2004
FROM T_matériel a, T_matériel b
WHERE a.Date_perception LIKE '*2005'
AND b.Date_perception LIKE '*2004'
Auriez vous une idée ?
Merci d'avance !
DNI.
Bonjour Denis
Tu peux faire un essai avec le code suivant
SELECT Year([Date_perception]) AS Année, Count(T_materiel.Date_perception)
AS CompteDeDate_perception
FROM T_materiel
GROUP BY Year([Date_perception]);
rené
"Denis" a écrit dans le message de
news:42693396$0$5674$Bonsoir à tous !
Voici mon problème du jour ;-)
J'ai une table 'T_matériel', dans laquelle existe un champ
'Date_perception', dont voici une idée du contenu:
01/1998
01/1995
09/2003
09/2003
10/2002
01/2000
01/2003
01/2002
01/1997
01/2001
09/2003
09/2003
09/2003
10/2002
10/2004
09/2002
10/2004
10/2004
01/1999
09/2001
09/2003
10/2002
10/2002
10/2004
09/2003
Le résultat que je souhaiterais obtenir est le suivant:
2005 2004 2003 2002 2001 2000 -de 2000
0 4 8 6 2 1 4
Voici ce que j'ai pensé faire comme requête, mais qui malheureusement ne
fonctionne pas, car pour les 2 champs, j'obtiens la même valeur :
SELECT count(a.Date_perception) AS 2005, count(b.Date_perception) AS 2004
FROM T_matériel a, T_matériel b
WHERE a.Date_perception LIKE '*2005'
AND b.Date_perception LIKE '*2004'
Auriez vous une idée ?
Merci d'avance !
DNI.
Pour info, j'ais enfin réussi a obtenir ce que je souhaitais:
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now) GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-1 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-2 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-3 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-4 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-5 GROUP BY
Right(Date_perception,4)
UNION
SELECT 'Non renseigné' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N' AND Date_perception LIKE '' OR
Date_perception IS NULL GROUP BY'Non renseigné'
UNION
SELECT 'Avant 2000' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N'
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-1
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-2
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-3
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-4
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-5
AND Date_perception NOT LIKE '' AND Date_perception IS NOT NULL
GROUP BY 'Avant 2000'
Merci à Raymond et à René pour leurs lumières ;-)
DNI.
Pour info, j'ais enfin réussi a obtenir ce que je souhaitais:
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now) GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-1 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-2 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-3 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-4 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-5 GROUP BY
Right(Date_perception,4)
UNION
SELECT 'Non renseigné' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N' AND Date_perception LIKE '' OR
Date_perception IS NULL GROUP BY'Non renseigné'
UNION
SELECT 'Avant 2000' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N'
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-1
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-2
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-3
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-4
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-5
AND Date_perception NOT LIKE '' AND Date_perception IS NOT NULL
GROUP BY 'Avant 2000'
Merci à Raymond et à René pour leurs lumières ;-)
DNI.
Pour info, j'ais enfin réussi a obtenir ce que je souhaitais:
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now) GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-1 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-2 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-3 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-4 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-5 GROUP BY
Right(Date_perception,4)
UNION
SELECT 'Non renseigné' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N' AND Date_perception LIKE '' OR
Date_perception IS NULL GROUP BY'Non renseigné'
UNION
SELECT 'Avant 2000' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N'
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-1
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-2
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-3
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-4
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-5
AND Date_perception NOT LIKE '' AND Date_perception IS NOT NULL
GROUP BY 'Avant 2000'
Merci à Raymond et à René pour leurs lumières ;-)
DNI.
Pour info, j'ais enfin réussi a obtenir ce que je souhaitais:
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now) GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-1 GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-2 GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-3 GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-4 GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-5 GROUP BY Right(Date_perception,4)
UNION
SELECT 'Non renseigné' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N' AND Date_perception LIKE '' OR
Date_perception IS NULL GROUP BY'Non renseigné'
UNION
SELECT 'Avant 2000' AS Année,count(Id_materiel) AS Quantite FROM T_materiel
WHERE Type_materiel Like 'N'
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-1
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-2
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-3
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-4
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-5
AND Date_perception NOT LIKE '' AND Date_perception IS NOT NULL
GROUP BY 'Avant 2000'
Merci à Raymond et à René pour leurs lumières ;-)
DNI.
Pour info, j'ais enfin réussi a obtenir ce que je souhaitais:
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now) GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-1 GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-2 GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-3 GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-4 GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-5 GROUP BY Right(Date_perception,4)
UNION
SELECT 'Non renseigné' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N' AND Date_perception LIKE '' OR
Date_perception IS NULL GROUP BY'Non renseigné'
UNION
SELECT 'Avant 2000' AS Année,count(Id_materiel) AS Quantite FROM T_materiel
WHERE Type_materiel Like 'N'
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-1
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-2
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-3
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-4
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-5
AND Date_perception NOT LIKE '' AND Date_perception IS NOT NULL
GROUP BY 'Avant 2000'
Merci à Raymond et à René pour leurs lumières ;-)
DNI.
Pour info, j'ais enfin réussi a obtenir ce que je souhaitais:
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now) GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-1 GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-2 GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-3 GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-4 GROUP BY Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS Quantite
FROM T_materiel WHERE Type_materiel='N' AND Right(Date_perception,4) LIKE
DatePart("YYYY", Now)-5 GROUP BY Right(Date_perception,4)
UNION
SELECT 'Non renseigné' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N' AND Date_perception LIKE '' OR
Date_perception IS NULL GROUP BY'Non renseigné'
UNION
SELECT 'Avant 2000' AS Année,count(Id_materiel) AS Quantite FROM T_materiel
WHERE Type_materiel Like 'N'
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-1
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-2
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-3
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-4
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-5
AND Date_perception NOT LIKE '' AND Date_perception IS NOT NULL
GROUP BY 'Avant 2000'
Merci à Raymond et à René pour leurs lumières ;-)
DNI.
Bonjour Denis,
la requête suivante me parait bien plus simple que ce que tu fais,
amélioration de celle que je t'ai déja proposée.
Une table avec un champ Date1 de type Texte contenant tes données
affichées sur le 1er post et un autre champ (ici toto contenant une autre
valeur Texte)
TRANSFORM Count(T_Materiel.toto) AS CompteDetoto
SELECT
replace(DMax("year([Date_perception])","T_Materiel"),DMax("year([Date_perception])","T_Materiel"),"nb
occurences") AS Expr1
FROM T_Materiel
GROUP BY
replace(DMax("year([Date_perception])","T_Materiel"),DMax("year([Date_perception])","T_Materiel"),"nb
occurences")
ORDER BY IIf(IsNull(Year([Date_perception]))," Non
Renseigné",IIf(Year([Date_perception])<2000,"<
2000",Year([Date_perception]))) DESC
PIVOT IIf(IsNull(Year([Date_perception]))," Non
Renseigné",IIf(Year([Date_perception])<2000,"<
2000",Year([Date_perception])));
Tu obtiens les résultats souhaités.
A+
Eric
PS: la fonction Année(Date1) retourne 2003 si Date1 contient 01/2003 même
si le champ est de type TextePour info, j'ais enfin réussi a obtenir ce que je souhaitais:
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now) GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-1 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-2 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-3 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-4 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-5 GROUP BY
Right(Date_perception,4)
UNION
SELECT 'Non renseigné' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N' AND Date_perception LIKE '' OR
Date_perception IS NULL GROUP BY'Non renseigné'
UNION
SELECT 'Avant 2000' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N'
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-1
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-2
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-3
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-4
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-5
AND Date_perception NOT LIKE '' AND Date_perception IS NOT NULL
GROUP BY 'Avant 2000'
Merci à Raymond et à René pour leurs lumières ;-)
DNI.
Bonjour Denis,
la requête suivante me parait bien plus simple que ce que tu fais,
amélioration de celle que je t'ai déja proposée.
Une table avec un champ Date1 de type Texte contenant tes données
affichées sur le 1er post et un autre champ (ici toto contenant une autre
valeur Texte)
TRANSFORM Count(T_Materiel.toto) AS CompteDetoto
SELECT
replace(DMax("year([Date_perception])","T_Materiel"),DMax("year([Date_perception])","T_Materiel"),"nb
occurences") AS Expr1
FROM T_Materiel
GROUP BY
replace(DMax("year([Date_perception])","T_Materiel"),DMax("year([Date_perception])","T_Materiel"),"nb
occurences")
ORDER BY IIf(IsNull(Year([Date_perception]))," Non
Renseigné",IIf(Year([Date_perception])<2000,"<
2000",Year([Date_perception]))) DESC
PIVOT IIf(IsNull(Year([Date_perception]))," Non
Renseigné",IIf(Year([Date_perception])<2000,"<
2000",Year([Date_perception])));
Tu obtiens les résultats souhaités.
A+
Eric
PS: la fonction Année(Date1) retourne 2003 si Date1 contient 01/2003 même
si le champ est de type Texte
Pour info, j'ais enfin réussi a obtenir ce que je souhaitais:
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now) GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-1 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-2 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-3 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-4 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-5 GROUP BY
Right(Date_perception,4)
UNION
SELECT 'Non renseigné' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N' AND Date_perception LIKE '' OR
Date_perception IS NULL GROUP BY'Non renseigné'
UNION
SELECT 'Avant 2000' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N'
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-1
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-2
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-3
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-4
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-5
AND Date_perception NOT LIKE '' AND Date_perception IS NOT NULL
GROUP BY 'Avant 2000'
Merci à Raymond et à René pour leurs lumières ;-)
DNI.
Bonjour Denis,
la requête suivante me parait bien plus simple que ce que tu fais,
amélioration de celle que je t'ai déja proposée.
Une table avec un champ Date1 de type Texte contenant tes données
affichées sur le 1er post et un autre champ (ici toto contenant une autre
valeur Texte)
TRANSFORM Count(T_Materiel.toto) AS CompteDetoto
SELECT
replace(DMax("year([Date_perception])","T_Materiel"),DMax("year([Date_perception])","T_Materiel"),"nb
occurences") AS Expr1
FROM T_Materiel
GROUP BY
replace(DMax("year([Date_perception])","T_Materiel"),DMax("year([Date_perception])","T_Materiel"),"nb
occurences")
ORDER BY IIf(IsNull(Year([Date_perception]))," Non
Renseigné",IIf(Year([Date_perception])<2000,"<
2000",Year([Date_perception]))) DESC
PIVOT IIf(IsNull(Year([Date_perception]))," Non
Renseigné",IIf(Year([Date_perception])<2000,"<
2000",Year([Date_perception])));
Tu obtiens les résultats souhaités.
A+
Eric
PS: la fonction Année(Date1) retourne 2003 si Date1 contient 01/2003 même
si le champ est de type TextePour info, j'ais enfin réussi a obtenir ce que je souhaitais:
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now) GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-1 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-2 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-3 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-4 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-5 GROUP BY
Right(Date_perception,4)
UNION
SELECT 'Non renseigné' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N' AND Date_perception LIKE '' OR
Date_perception IS NULL GROUP BY'Non renseigné'
UNION
SELECT 'Avant 2000' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N'
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-1
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-2
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-3
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-4
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-5
AND Date_perception NOT LIKE '' AND Date_perception IS NOT NULL
GROUP BY 'Avant 2000'
Merci à Raymond et à René pour leurs lumières ;-)
DNI.
Bonsoir Eric !
Alors là, ben je dois avouer que je ne conaissais ni le "IIf", ni le "PIVOT
" .... vais fouiller un peu histoire de savoir ce que font ces fonctions ...
Sinon, j'ai essayé ton code, et j'ai constaté 2 choses:
- si je ne modifie pas le type de donnée du champs Date_perception en format
date, ben celà ne fonctionne pas -> "Type de données incompatible dans
l'expression du critère" ....
- je ne vois pas trop comment renseigner un graphique avec ce résultat :-(
Te remercie pour ton aide ;-)
Denis.
"Eric" a écrit dans le message de news:
u$Bonjour Denis,
la requête suivante me parait bien plus simple que ce que tu fais,
amélioration de celle que je t'ai déja proposée.
Une table avec un champ Date1 de type Texte contenant tes données
affichées sur le 1er post et un autre champ (ici toto contenant une autre
valeur Texte)
TRANSFORM Count(T_Materiel.toto) AS CompteDetoto
SELECT
replace(DMax("year([Date_perception])","T_Materiel"),DMax("year([Date_perception])","T_Materiel"),"nb
occurences") AS Expr1
FROM T_Materiel
GROUP BY
replace(DMax("year([Date_perception])","T_Materiel"),DMax("year([Date_perception])","T_Materiel"),"nb
occurences")
ORDER BY IIf(IsNull(Year([Date_perception]))," Non
Renseigné",IIf(Year([Date_perception])<2000,"<
2000",Year([Date_perception]))) DESC
PIVOT IIf(IsNull(Year([Date_perception]))," Non
Renseigné",IIf(Year([Date_perception])<2000,"<
2000",Year([Date_perception])));
Tu obtiens les résultats souhaités.
A+
Eric
PS: la fonction Année(Date1) retourne 2003 si Date1 contient 01/2003 même
si le champ est de type TextePour info, j'ais enfin réussi a obtenir ce que je souhaitais:
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now) GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-1 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-2 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-3 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-4 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-5 GROUP BY
Right(Date_perception,4)
UNION
SELECT 'Non renseigné' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N' AND Date_perception LIKE '' OR
Date_perception IS NULL GROUP BY'Non renseigné'
UNION
SELECT 'Avant 2000' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N'
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-1
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-2
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-3
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-4
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-5
AND Date_perception NOT LIKE '' AND Date_perception IS NOT NULL
GROUP BY 'Avant 2000'
Merci à Raymond et à René pour leurs lumières ;-)
DNI.
Bonsoir Eric !
Alors là, ben je dois avouer que je ne conaissais ni le "IIf", ni le "PIVOT
" .... vais fouiller un peu histoire de savoir ce que font ces fonctions ...
Sinon, j'ai essayé ton code, et j'ai constaté 2 choses:
- si je ne modifie pas le type de donnée du champs Date_perception en format
date, ben celà ne fonctionne pas -> "Type de données incompatible dans
l'expression du critère" ....
- je ne vois pas trop comment renseigner un graphique avec ce résultat :-(
Te remercie pour ton aide ;-)
Denis.
"Eric" <f_framZZ@hotmail.com> a écrit dans le message de news:
u$BQuePSFHA.1172@TK2MSFTNGP12.phx.gbl...
Bonjour Denis,
la requête suivante me parait bien plus simple que ce que tu fais,
amélioration de celle que je t'ai déja proposée.
Une table avec un champ Date1 de type Texte contenant tes données
affichées sur le 1er post et un autre champ (ici toto contenant une autre
valeur Texte)
TRANSFORM Count(T_Materiel.toto) AS CompteDetoto
SELECT
replace(DMax("year([Date_perception])","T_Materiel"),DMax("year([Date_perception])","T_Materiel"),"nb
occurences") AS Expr1
FROM T_Materiel
GROUP BY
replace(DMax("year([Date_perception])","T_Materiel"),DMax("year([Date_perception])","T_Materiel"),"nb
occurences")
ORDER BY IIf(IsNull(Year([Date_perception]))," Non
Renseigné",IIf(Year([Date_perception])<2000,"<
2000",Year([Date_perception]))) DESC
PIVOT IIf(IsNull(Year([Date_perception]))," Non
Renseigné",IIf(Year([Date_perception])<2000,"<
2000",Year([Date_perception])));
Tu obtiens les résultats souhaités.
A+
Eric
PS: la fonction Année(Date1) retourne 2003 si Date1 contient 01/2003 même
si le champ est de type Texte
Pour info, j'ais enfin réussi a obtenir ce que je souhaitais:
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now) GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-1 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-2 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-3 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-4 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-5 GROUP BY
Right(Date_perception,4)
UNION
SELECT 'Non renseigné' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N' AND Date_perception LIKE '' OR
Date_perception IS NULL GROUP BY'Non renseigné'
UNION
SELECT 'Avant 2000' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N'
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-1
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-2
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-3
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-4
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-5
AND Date_perception NOT LIKE '' AND Date_perception IS NOT NULL
GROUP BY 'Avant 2000'
Merci à Raymond et à René pour leurs lumières ;-)
DNI.
Bonsoir Eric !
Alors là, ben je dois avouer que je ne conaissais ni le "IIf", ni le "PIVOT
" .... vais fouiller un peu histoire de savoir ce que font ces fonctions ...
Sinon, j'ai essayé ton code, et j'ai constaté 2 choses:
- si je ne modifie pas le type de donnée du champs Date_perception en format
date, ben celà ne fonctionne pas -> "Type de données incompatible dans
l'expression du critère" ....
- je ne vois pas trop comment renseigner un graphique avec ce résultat :-(
Te remercie pour ton aide ;-)
Denis.
"Eric" a écrit dans le message de news:
u$Bonjour Denis,
la requête suivante me parait bien plus simple que ce que tu fais,
amélioration de celle que je t'ai déja proposée.
Une table avec un champ Date1 de type Texte contenant tes données
affichées sur le 1er post et un autre champ (ici toto contenant une autre
valeur Texte)
TRANSFORM Count(T_Materiel.toto) AS CompteDetoto
SELECT
replace(DMax("year([Date_perception])","T_Materiel"),DMax("year([Date_perception])","T_Materiel"),"nb
occurences") AS Expr1
FROM T_Materiel
GROUP BY
replace(DMax("year([Date_perception])","T_Materiel"),DMax("year([Date_perception])","T_Materiel"),"nb
occurences")
ORDER BY IIf(IsNull(Year([Date_perception]))," Non
Renseigné",IIf(Year([Date_perception])<2000,"<
2000",Year([Date_perception]))) DESC
PIVOT IIf(IsNull(Year([Date_perception]))," Non
Renseigné",IIf(Year([Date_perception])<2000,"<
2000",Year([Date_perception])));
Tu obtiens les résultats souhaités.
A+
Eric
PS: la fonction Année(Date1) retourne 2003 si Date1 contient 01/2003 même
si le champ est de type TextePour info, j'ais enfin réussi a obtenir ce que je souhaitais:
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now) GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-1 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-2 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-3 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-4 GROUP BY
Right(Date_perception,4)
UNION
SELECT Right(Date_perception,4) AS Année, Count(Date_perception) AS
Quantite FROM T_materiel WHERE Type_materiel='N' AND
Right(Date_perception,4) LIKE DatePart("YYYY", Now)-5 GROUP BY
Right(Date_perception,4)
UNION
SELECT 'Non renseigné' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N' AND Date_perception LIKE '' OR
Date_perception IS NULL GROUP BY'Non renseigné'
UNION
SELECT 'Avant 2000' AS Année,count(Id_materiel) AS Quantite FROM
T_materiel WHERE Type_materiel Like 'N'
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-1
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-2
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-3
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-4
AND Right(Date_perception,4) NOT LIKE DatePart("YYYY", Now)-5
AND Date_perception NOT LIKE '' AND Date_perception IS NOT NULL
GROUP BY 'Avant 2000'
Merci à Raymond et à René pour leurs lumières ;-)
DNI.