1 2 3 4 5 6
| Dim n As Integer, s As String, rst As New ADODB.Recordset
...
rst.open "SELECT r.nop as operation, max(jour) as finie_le, r.libelle, round(r.tprepa/o.qliv+r.tprevu,2) as prevu_unit, r.poste, o.cd_of, o.qliv, round(sum(t)/o.qliv,2) as reel_unit " _
& "FROM ((operations r inner join [OF] o on o.draw_ref=r.draw_ref) left join of_taches t on t.cd_of=o.cd_of) left join pointages p on p.cd_tache=t.cd_tache " _
& "WHERE o.etat='T' and o.qliv>0 and o.date_fin>=dateadd(" & IIf(msql, "m,-" & n & ",get", "'m',-" & n & ",") & "date()) and t.nop=r.nop and r.draw_ref='" & x_draw_ref _
& "' GROUP BY r.nop, r.libelle, r.tprepa, r.tprevu, r.poste, o.cd_of, o.qliv HAVING " & IIf(msql, "coalesce", "nz") & "(sum(t),0)+r.tprepa+r.tprevu>0.01 ORDER BY 1,2,6;", cnx, adOpenStatic |
Partager