sql - Trying to perform sum of count using group by and union -


I am trying to sum up the count of three queries using the union. These questions include their inner currents. Below is my query that I have written:

  Select Remove (from the beginning to the year), Remove (start_date from month), APPLICATION_TYPE, sum totaling (total) .start_date) START_YEAR, Removal (months from A.start_date) as Start_Month, in the form of a type A.APPLICATION_TYPE, lnr_application counts as a total (A.TRANSACTION_NUMBER) where A.START_DATE & gt; = TO_DATE ('& amp; sdate', 'DD / MM / YYYY') and A.START_DATE & lt; = Removal (by year from start_date), extract (months from start_date) = TO_DATE ('& amp; EDATE', 'DD / MM / YYYY') and A.permission_type = 'AP' (in and A.status_cd 'HRW') ), A.APPLICATION_TYPE Union Select all (Year from A.tstamp) as START_YEAR, extract (Month from A.tstamp) Start_Month, as the type of A.application_type, count as type (A.transaction_number) lnr_application The total from one where A.permission_type = 'HRW' and A.status_cd ('RF') and TRUNC (A.tstamp) & gt; = TO_DATE ('& amp; sdate', 'dd / mm / yyyy') and trunk (stamps) < Remove the group (the year from the stamps) by extracting to = to_date ('& amp; edate', 'dd / mm / yay'), remove (A.tstamp from month), A.application_type unselect all selected (from year A.tstamp ) Start_Year, remove (month from A.tstamp) Start_Month, as a.application_type as the type, lnr_application one where A.permission_type = 'HRW' and ('cl') A.status_cd and TRUNC (A.tstamp ) & Gt; (A.transaction_number) counted as total; = TO_DATE (Group by ATSTamp) and trunk (astramp) by extracting & lt; = to_date ('& amp; edate', 'dd / mm / yy') group), extract (A. Removing (month from tstamp), A.application_type, removing tmp group (year from start_date), extracting (from start_date), extracting APPLICATION_TYPE order (year from start_date), start_date (month), APPLICATION_TYPE   

When I execute the query, I get an error message that Start_Date is an invalid identifier if I want to remove it from the upper component If I remove the re-share, then in the union of all three questions, I get the following result: 2011 7A 627 2011 7A 21 2011 7A1 2011 7C 1585 2011 7C1 2011 I want to deduct the total amount of calculations for the respective year, month and application type: 2011 7A649 2011 7C1586 2011 7I158

Can someone help me?

In the union selection statement, you must use Start_Year and Start_Month instead of the extant statement. Also, use Type instead of Application_Type

Comments