| 1 | = Compte les lots = |
| 2 | Retour à [wiki:"Recette SQL"] |
| 3 | |
| 4 | [[PageOutline]] |
| 5 | |
| 6 | |
| 7 | {{{ |
| 8 | |
| 9 | set search path to migradour; |
| 10 | SELECT |
| 11 | ouv_sta_code as sta_code, |
| 12 | ouv_code, |
| 13 | ouv_libelle, |
| 14 | dis2.dis_identifiant as df, |
| 15 | dis2.dis_commentaires as df_commentaires, |
| 16 | dif_code, |
| 17 | dis1.dis_identifiant as dc, |
| 18 | dis1.dis_commentaires as dc_commentaires, |
| 19 | dic_code, |
| 20 | count(lot_identifiant) |
| 21 | from tg_dispositif_dis dis1 |
| 22 | JOIN t_dispositifcomptage_dic ON dic_dis_identifiant=dis_identifiant |
| 23 | JOIN t_dispositiffranchissement_dif dif ON dic_dif_identifiant=dif_dis_identifiant |
| 24 | JOIN tg_dispositif_dis dis2 ON dif_dis_identifiant=dis2.dis_identifiant |
| 25 | JOIN t_ouvrage_ouv ouv ON dif_ouv_identifiant=ouv_identifiant |
| 26 | LEFT JOIN t_operation_ope ON ope_dic_identifiant=dis1.dis_identifiant |
| 27 | LEFT JOIN t_lot_lot on lot_ope_identifiant=ope_identifiant |
| 28 | group by ope_dic_identifiant,ouv_sta_code,ouv_code,ouv_libelle,df,df_commentaires,dif_code,dc,dc_commentaires,dic_code; |
| 29 | }}} |