title: Simplify SQL request
body: <p>I have a sql query i use in sqlite which in fact is a UNION of 3 SELECT statements.</p>
  
  <p>I'd like to simplify it. Could someone help me? </p>
  
  <pre><code>Select *, "A" as Status
    FROM (SELECT ADM_ID,
                 Dte_Implantation,
                 Dte_modif,
                 SUP_EMETTEUR_052016.EMR_ID         as 'EMR_ID',
                 SUP_EMETTEUR_052016.STA_NM_ANFR    as 'STA_NM_ANFR',
                 SUP_EMETTEUR_052016.EMR_LB_SYSTEME as 'EMR_LB_SYSTEME'
            FROM SUP_STATION_052016
            left outer join SUP_EMETTEUR_052016
              ON SUP_STATION_052016.STA_NM_ANFR =
                 SUP_EMETTEUR_052016.STA_NM_ANFR
           WHERE Dte_Implantation &gt;
                 (SELECT MAX(Dte_Implantation) FROM SUP_STATION_042016)
             AND (ADM_ID = 6 or ADM_ID = 23 or ADM_ID = 137 or
                 ADM_ID = 240))
  UNION ALL
  select *, "A" as Status
    FROM (SELECT ADM_ID,
                 Dte_Implantation,
                 Dte_modif,
                 SUP_EMETTEUR_052016.EMR_ID         as 'EMR_ID',
                 SUP_EMETTEUR_052016.STA_NM_ANFR    as 'STA_NM_ANFR',
                 SUP_EMETTEUR_052016.EMR_LB_SYSTEME as 'EMR_LB_SYSTEME'
            FROM SUP_STATION_052016
            left outer join SUP_EMETTEUR_052016
              ON SUP_STATION_052016.STA_NM_ANFR =
                 SUP_EMETTEUR_052016.STA_NM_ANFR
           WHERE Dte_modif &gt;
                 (SELECT MAX(Dte_Implantation) FROM SUP_STATION_042016)
             AND (ADM_ID = 6 or ADM_ID = 23 or ADM_ID = 137 or
                 ADM_ID = 240) EXCEPT
            SELECT ADM_ID,
                   Dte_Implantation,
                   Dte_modif,
                   SUP_EMETTEUR_042016.EMR_ID         as 'EMR_ID',
                   SUP_EMETTEUR_042016.STA_NM_ANFR    as 'STA_NM_ANFR',
                   SUP_EMETTEUR_042016.EMR_LB_SYSTEME as 'EMR_LB_SYSTEME'
                    FROM SUP_STATION_052016
                    left outer join SUP_EMETTEUR_042016
                      ON SUP_STATION_052016.STA_NM_ANFR =
                         SUP_EMETTEUR_042016.STA_NM_ANFR
                   WHERE Dte_modif &gt;
                         (SELECT MAX(Dte_Implantation)
                            FROM SUP_STATION_042016)
                     AND (ADM_ID = 6 or ADM_ID = 23 or ADM_ID = 137 or
                         ADM_ID = 240)
          )
  UNION ALL
  select *, "S" as Status
    FROM (SELECT ADM_ID,
                 Dte_Implantation,
                 Dte_modif,
                 SUP_EMETTEUR_042016.EMR_ID         as 'EMR_ID',
                 SUP_EMETTEUR_042016.STA_NM_ANFR    as 'STA_NM_ANFR',
                 SUP_EMETTEUR_042016.EMR_LB_SYSTEME as 'EMR_LB_SYSTEME'
            FROM SUP_STATION_052016
            left outer join SUP_EMETTEUR_042016
              ON SUP_STATION_052016.STA_NM_ANFR =
                 SUP_EMETTEUR_042016.STA_NM_ANFR
           WHERE Dte_modif &gt;
                 (SELECT MAX(Dte_Implantation) FROM SUP_STATION_042016)
             AND (ADM_ID = 6 or ADM_ID = 23 or ADM_ID = 137 or
                 ADM_ID = 240) EXCEPT
            SELECT ADM_ID,
                   Dte_Implantation,
                   Dte_modif,
                   SUP_EMETTEUR_052016.EMR_ID         as 'EMR_ID',
                   SUP_EMETTEUR_052016.STA_NM_ANFR    as 'STA_NM_ANFR',
                   SUP_EMETTEUR_052016.EMR_LB_SYSTEME as 'EMR_LB_SYSTEME'
                    FROM SUP_STATION_052016
                    left outer join SUP_EMETTEUR_052016
                      ON SUP_STATION_052016.STA_NM_ANFR =
                         SUP_EMETTEUR_052016.STA_NM_ANFR
                   WHERE Dte_modif &gt;
                         (SELECT MAX(Dte_Implantation)
                            FROM SUP_STATION_042016)
                     AND (ADM_ID = 6 or ADM_ID = 23 or ADM_ID = 137 or
                         ADM_ID = 240)
          )
  </code></pre>