Requête trop complexe

abjs -  
 abjs -
Bonjour,

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

dna.factory Messages postés 26054 Date d'inscription   Statut Modérateur Dernière intervention   1 619
 
comment ç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...
0
abjs
 
comment je peux t'envoyer ma requete?
0
Heremion Messages postés 538 Date d'inscription   Statut Membre Dernière intervention   102
 
Bonjour Abjs, commence par faire un copier coller de ta requête pour que nous puissions en avoir un aperçu rapide...
0
abjs
 
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é à];
0
Heremion Messages postés 538 Date d'inscription   Statut Membre Dernière intervention   102
 
what shoot!!!!! ok, bon va revoir la requête au clair ^^
0
abjs
 
quoi?
0
Heremion Messages postés 538 Date d'inscription   Statut Membre Dernière intervention   102
 
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é à];
0
dna.factory Messages postés 26054 Date d'inscription   Statut Modérateur Dernière intervention   1 619
 
juste 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 ?
0
abjs
 
c'est la paye de mes employés
0
dna.factory Messages postés 26054 Date d'inscription   Statut Modérateur Dernière intervention   1 619
 
je 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
0
abjs
 
aie alors là je comprends rien!
0
abjs
 
qui veut bien m'apprendre, je sais faire des tables des formulaires et des requetes c tout!!!
0
Heremion Messages postés 538 Date d'inscription   Statut Membre Dernière intervention   102
 
euh je viens de penser à un truc... la requête tu la lances avec quoi? car un IIF dans un SELECT me semble un peu bourrin non?
0