Too complex a request
abjs
-
abjs -
abjs -
Hello,
I am a beginner with Access, I created a database for payroll but my query is too complex!!
how to do?
Configuration: Windows XP / Firefox 8.0
I am a beginner with Access, I created a database for payroll but my query is too complex!!
how to do?
Configuration: Windows XP / Firefox 8.0
3 answers
-
Why is it so complex?
Complex because you don’t know how to make your query, or complex because your database was poorly designed and thus poorly created...
--
Stop failing the Turing test! -
-
-
Yes, how do we do it if I paste the code it doesn’t work!!
SELECT Tasks.[DATE PAID], Tasks.[Assigned to], Employees.[LIBELLE CI NOM Prénom], Employees.DTNAISS, Employees.Nationality, Employees.[Marital Status], Employees.City, Employees.Department, Employees.N°_CNPS, Employees.DATEENTREESTE, Round([BASE]/176*[HNORMALE]) AS [salary 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, Employees.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 Employees RIGHT JOIN (([POSITION] INNER JOIN Tasks ON POSITION.ID = Tasks.POSITION) LEFT JOIN paye ON Tasks.ID = paye.ID_TACHE) ON Employees.ID = Tasks.[Assigned to]
ORDER BY Tasks.[DATE PAID], Tasks.[Assigned to]; -
-
-
SELECT Tasks.[DATE PAID], Tasks.[Assigned to], Employees.[LIBELLE CI NOM Prénom], Employees.DTNAISS, Employees.Nationality, Employees.[Civil status], Employees.City, Employees.Department, Employees.N°_CNPS, Employees.DATEENTREESTE, Round([BASE]/176*[HNORMALE]) AS [base salary], 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, Employees.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 to Pay], Round([net to pay]-[percu]) AS due, * FROM Employees RIGHT JOIN (([POSITION] INNER JOIN Tasks ON POSITION.ID = Tasks.POSITION) LEFT JOIN pays ON Tasks.ID = pays.ID_TACHE) ON Employees.ID = Tasks.[Assigned to] ORDER BY Tasks.[DATE PAID], Tasks.[Assigned to];
-
-
just a question, what should your request actually do?
isn't there a way to simplify it?
to cut it into several requests?
to manage part of it in code instead of the request?
--
Stop failing the turing test !-
-
I know this isn’t the answer you want to hear. but for me, you’re tackling the problem the wrong way...
access to reason... (yes, said like that, it’s weird), your request is too complex.
too complex for a program, but also too complex for a human.
it will be impossible to maintain, or to evolve.
for me the solution is to encapsulate the request in a program, rather than encapsulating the program in the request -
-
-
-