Requête trop complexe
je suis débutante sur access, j'ai fait une base de données pour la paye mais ma requête est trop complexe!!
comment faire?
3 réponses
Des débutants sur Access rencontrent une difficulté liée à une base de données de paie où une requête devient trop complexe à exécuter. Plusieurs réponses suggèrent de clarifier d'abord les points bloquants, distinguer complexité réelle et conception de la base, puis décomposer la requête en éléments plus simples. D'autres incitent à partager la requête ou à décrire ce qui gêne, notamment la longueur, l'utilisation d IIF dans les SELECT, et à tester étape par étape. Pour aller plus loin, la discussion rappelle qu'Access peut être sensible aux performances avec des requêtes imbriquées ou mal pensées, et qu'une approche progressive peut aider.
-
Modérateurcomment ça trop complèxe ?
complexe dans le sens tu ne sais pas faire ta requete, ou complexe dans le sens ta base de donnée a été mal pensée et donc mal crée... -
comment je peux t'envoyer ma requete?
-
-
oui comment on fait si je colle le code ça veut pas!!
SELECT Tâches.[DATE PAYE], Tâches.[Affecté à], Employés.[LIBELLE CI NOM Prénom], Employés.DTNAISS, Employés.Nationality, Employés.[Etat civil], Employés.Ville, Employés.Département, Employés.N°_CNPS, Employés.DATEENTREESTE, Round([BASE]/176*[HNORMALE]) AS [salaire base], IIf([TYPE PAYE]='marée',Round([sursalaire]*[HNORMALE]),Round([SURSALAIRE RECUP]*[HNORMALE])) AS SURS, Round(([BASE]/176)*1.15*[HEURES SUPPLEMENTAIRES A 15%]) AS hsup15, Round(([BASE]/176)*1.5*[HEURES SUPPLEMENTAIRES A 50%]) AS hsup50, Round(([BASE]/176)*1.75*[HEURES SUPPLEMENTAIRES A 75%]) AS hsup75, IIf([TYPE PAYE]='marée',30000,0) AS primtrav, IIf([TYPE PAYE]='marée',8500,0) AS primMER, IIf([TYPE PAYE]='marée',8500,0) AS primRisque, IIf([TYPE PAYE]='marée',[% PRIME]*[POSITION]![PRIME DE PERFORMANCE],0) AS primPerf, Round([salaire base]+[SURS]+[hsup15]+[hsup50]+[hsup75]+[primMER]+[primRisque]+[primtrav]+[primPerf]) AS Brutimp, Round([Brutimp]*0.012) AS [IS], Round([Brutimp]*0.8) AS bcn, Round(IIf([bcn]<130000,([bcn]-50000)*0.015,IIf([bcn]<200000,(([bcn]-130000)*0.05)+1200,IIf([bcn]>200000,([bcn]-200000)*0.1+4700,0)))) AS CN, Employés.PARTS, Round((([bcn]-([IS]+[CN]))*0.85)) AS bigr, Round(IIf([bigr]/[PARTS]<=45583,(([bigr]*0.0909)-([PARTS]*2273)),IIf([bigr]/[PARTS]<=81583,(([bigr]*0.1304)-([PARTS]*4076)),IIf([bigr]/[PARTS]<=126583,(([bigr]*0.1666)-([PARTS]*7031)),IIf([bigr]/[PARTS]<=220333,(([bigr]*0.2)-([PARTS]*11250)),IIf([bigr]/[PARTS]<=389083,(([bigr]*0.2592)-(24306*[PARTS])),IIf([bigr]/[PARTS]<=842166,(([bigr]*0.3103)-(44181*[PARTS])),IIf([bigr]/[parts]>=842167,(([bigr]*0.375)-(98633*[PARTS])),0)))))))) AS IGR, Round([Brutimp]*0.032) AS CNPS, Round([Brutimp]*0.012) AS CNlocpat, Round([Brutimp]*0.004) AS TaxApp, Round([Brutimp]*0.006) AS TaxFormPro, Round(IIf([Brutimp]>70000,70000*0.02,[Brutimp]*0.02)) AS CNPSAcc, Round(IIf([Brutimp]>70000,70000*0.0575,[Brutimp]*0.0575)) AS CNPSprestfam, [IS]+[IGR]+[CN]+[ARRONDI DE PAIE<0] AS TotRetenue, [ARRONDI DE PAIE]+[Brutimp]+[TRANSPORT] AS TotGAINS, Round([TotGAINS]-[TotRetenue]) AS [NET à Payer], Round([net à payer]-[percu]) AS du, *
FROM Employés RIGHT JOIN (([POSITION] INNER JOIN Tâches ON POSITION.ID = Tâches.POSITION) LEFT JOIN paye ON Tâches.ID = paye.ID_TACHE) ON Employés.ID = Tâches.[Affecté à]
ORDER BY Tâches.[DATE PAYE], Tâches.[Affecté à]; -
-
-
SELECT Tâches.[DATE PAYE], Tâches.[Affecté à], Employés.[LIBELLE CI NOM Prénom], Employés.DTNAISS, Employés.Nationality, Employés.[Etat civil], Employés.Ville, Employés.Département, Employés.N°_CNPS, Employés.DATEENTREESTE, Round([BASE]/176*[HNORMALE]) AS [salaire base], IIf([TYPE PAYE]='marée', Round([sursalaire]*[HNORMALE]), Round([SURSALAIRE RECUP]*[HNORMALE])) AS SURS, Round(([BASE]/176)*1.15*[HEURES SUPPLEMENTAIRES A 15%]) AS hsup15, Round(([BASE]/176)*1.5*[HEURES SUPPLEMENTAIRES A 50%]) AS hsup50, Round(([BASE]/176)*1.75*[HEURES SUPPLEMENTAIRES A 75%]) AS hsup75, IIf([TYPE PAYE]='marée',30000,0) AS primtrav, IIf([TYPE PAYE]='marée',8500,0) AS primMER, IIf([TYPE PAYE]='marée',8500,0) AS primRisque, IIf([TYPE PAYE]='marée',[% PRIME]*[POSITION]![PRIME DE PERFORMANCE],0) AS primPerf, Round([salaire base]+[SURS]+[hsup15]+[hsup50]+[hsup75]+[primMER]+[primRisque]+[primtrav]+[primPerf]) AS Brutimp, Round([Brutimp]*0.012) AS [IS], Round([Brutimp]*0.8) AS bcn, Round(IIf([bcn]<130000, ([bcn]-50000)*0.015, IIf([bcn]<200000, (([bcn]-130000)*0.05)+1200, IIf([bcn]>200000,([bcn]-200000)*0.1+4700,0)))) AS CN, Employés.PARTS, Round((([bcn]-([IS]+[CN]))*0.85)) AS bigr, Round(IIf([bigr]/[PARTS]<=45583, (([bigr]*0.0909)-([PARTS]*2273)), IIf([bigr]/[PARTS]<=81583, (([bigr]*0.1304)-([PARTS]*4076)), IIf([bigr]/[PARTS]<=126583, (([bigr]*0.1666)-([PARTS]*7031)), IIf([bigr]/[PARTS]<=220333, (([bigr]*0.2)-([PARTS]*11250)), IIf([bigr]/[PARTS]<=389083, (([bigr]*0.2592)-(24306*[PARTS])), IIf([bigr]/[PARTS]<=842166, (([bigr]*0.3103)-(44181*[PARTS])), IIf([bigr]/[parts]>=842167, (([bigr]*0.375)-(98633*[PARTS])),0)))))))) AS IGR, Round([Brutimp]*0.032) AS CNPS, Round([Brutimp]*0.012) AS CNlocpat, Round([Brutimp]*0.004) AS TaxApp, Round([Brutimp]*0.006) AS TaxFormPro, Round(IIf([Brutimp]>70000,70000*0.02,[Brutimp]*0.02)) AS CNPSAcc, Round(IIf([Brutimp]>70000,70000*0.0575,[Brutimp]*0.0575)) AS CNPSprestfam, [IS]+[IGR]+[CN]+[ARRONDI DE PAIE<0] AS TotRetenue, [ARRONDI DE PAIE]+[Brutimp]+[TRANSPORT] AS TotGAINS, Round([TotGAINS]-[TotRetenue]) AS [NET à Payer], Round([net à payer]-[percu]) AS du, * FROM Employés RIGHT JOIN (([POSITION] INNER JOIN Tâches ON POSITION.ID = Tâches.POSITION) LEFT JOIN paye ON Tâches.ID = paye.ID_TACHE) ON Employés.ID = Tâches.[Affecté à] ORDER BY Tâches.[DATE PAYE], Tâches.[Affecté à];
-
-
Modérateurjuste une question, ta requette, elle doit faire quoi en fait ?
y'a pas moyen de la simplifier ?
de la couper en plusieurs requetes ?
de gérer une partie dans du code au lieu de la requete ?-
-
Modérateurje sais que ce n'est pas la réponse que tu veux entendre. mais pour moi, tu prends le problème à l'envers...
acces à raison... (oui, dit comme ça, c'est bizarre), ta requette est trop complexe.
trop complexe pour un programme, mais aussi trop complexe pour un humain.
elle sera impossible a maintenir, ou a faire évoluer.
pour moi la solution consiste encapusler la requete dans un programme, plutot que d'encapsuler le programme dans la requette -
-
-
-