Date table accross the year with a union all query

Hi
I'm trying to create a table in SQL that will show the Output Values acrross the year.
I'm basically trying to change a date range of BETWEEN  '2014-01-01' AND '2014-01-30' as Jan show the Columns look like the below.
Jan
Feb
March
April
May
June
July
121
12
154
78
21
32
21
SELECT count(distinct [Form Number]) as Starts
FROM dbo.WATP
WHERE [Cohort Desc] IN ('BBC APPs', 'ETP', 'Foundation Learning', 'WBL Scheme')
AND [Episode Start] BETWEEN '2014-01-01' AND '2014-01-30'
UNION ALL
SELECT count(distinct [Form Number]) as Starts
FROM dbo.WATP
WHERE [Cohort Desc] IN ('BBC APPs', 'ETP', 'Foundation Learning', 'WBL Scheme')
AND [Episode Start] BETWEEN '2014-02-01' AND '2014-02-28'
UNION ALL
SELECT count(distinct [Form Number]) as Starts
FROM dbo.WATP
WHERE [Cohort Desc] IN ('BBC APPs', 'ETP', 'Foundation Learning', 'WBL Scheme')
AND [Episode Start] BETWEEN '2014-03-01' AND '2014-02-30'
UNION ALL
SELECT count(distinct [Form Number]) as Starts
FROM dbo.WATP
WHERE [Cohort Desc] IN ('BBC APPs', 'ETP', 'Foundation Learning', 'WBL Scheme')
AND [Episode Start] BETWEEN '2014-04-01' AND '2014-04-30'
Hope you can help,
SIIOBIIB

You can simplify that, like this:
DECLARE @WATP TABLE ([Form Number] INT IDENTITY, [Episode Start] DATE)
INSERT INTO @WATP ([Episode Start])
VALUES
('2013-01-01'),('2013-02-01'),('2013-04-01'),('2013-04-01'),('2013-05-01'),('2013-06-01'),
('2013-01-01'),('2013-02-01'),('2013-04-01'),('2013-04-01'),('2013-05-01'),('2013-06-01'),
('2014-01-01'),('2014-02-01'),('2014-03-01'),('2014-04-01'),('2014-05-01'),('2014-06-01'),
('2014-01-01'),('2014-02-01'),('2014-04-01'),('2014-04-01'),('2014-05-01'),('2014-06-01'),
('2014-01-01'),('2014-02-01'),('2014-04-01'),('2014-04-01'),('2014-05-01'),('2014-06-01'),
('2014-07-01'),('2014-08-01'),('2014-09-01'),('2014-10-01'),('2014-11-01'),('2014-12-01'),
('2014-07-01'),('2014-08-01'),('2014-09-01'),('2014-10-01'),('2014-11-01'),('2014-12-01'),
('2014-04-01'),('2014-05-01'),('2014-06-01'),('2014-04-01'),('2014-05-01'),('2014-06-01'),
('2014-04-01'),('2014-05-01'),('2014-06-01'),('2014-10-01'),('2014-11-01'),('2014-12-01'),
('2014-10-01'),('2014-11-01'),('2014-12-01')
SELECT YEAR([Episode Start]) AS year, COUNT(DISTINCT [Form Number]) AS yearTotal,
COUNT(DISTINCT CASE WHEN MONTH([Episode Start]) = 1 THEN [Form Number] END) AS Jan,
COUNT(DISTINCT CASE WHEN MONTH([Episode Start]) = 2 THEN [Form Number] END) AS Feb,
COUNT(DISTINCT CASE WHEN MONTH([Episode Start]) = 3 THEN [Form Number] END) AS Mar,
COUNT(DISTINCT CASE WHEN MONTH([Episode Start]) = 4 THEN [Form Number] END) AS Apr,
COUNT(DISTINCT CASE WHEN MONTH([Episode Start]) = 5 THEN [Form Number] END) AS May,
COUNT(DISTINCT CASE WHEN MONTH([Episode Start]) = 6 THEN [Form Number] END) AS Jun,
COUNT(DISTINCT CASE WHEN MONTH([Episode Start]) = 7 THEN [Form Number] END) AS Jul,
COUNT(DISTINCT CASE WHEN MONTH([Episode Start]) = 8 THEN [Form Number] END) AS Aug,
COUNT(DISTINCT CASE WHEN MONTH([Episode Start]) = 9 THEN [Form Number] END) AS Sep,
COUNT(DISTINCT CASE WHEN MONTH([Episode Start]) = 10 THEN [Form Number] END) AS Oct,
COUNT(DISTINCT CASE WHEN MONTH([Episode Start]) = 11 THEN [Form Number] END) AS Nov,
COUNT(DISTINCT CASE WHEN MONTH([Episode Start]) = 12 THEN [Form Number] END) AS Dec
FROM @WATP
GROUP BY YEAR([Episode Start])
Please include DDL,DML and example data when posing a question, it makes it much easier for us to help you.

Similar Messages

  • Sunday, I downloaded iTunes app on to my new PC.  Songs purchased over the years were present but all of the albums I loaded from CD's are not present.  How do I resore my iTunes account with all of my albums, playlists, etc.?

    Sunday, I downloaded iTunes app on to my new PC.  Songs purchased over the years were present but all of the albums I loaded from CD's are not present.  How do I resore my iTunes account with all of my albums, playlists, etc.?  I have not attempted to sysnch my IPod Nano with the new software.

    See Empty/corrupt iTunes library after upgrade/crash.
    tt2

  • Help with slow union all

    Hi
    The problem Im having is that I had a query on sales order tables that used to take a couple of minutes to run. The user wanted contract orders to be added to the query and these were stored in different tables to the sales orders. I carried out union all joins in views and then applied the query to the views. Unfortunately it now takes 30 minutes to run.
    I apologise for the large post, I am just trying to provide enough information for someone to help me out.
    Any help will be greatly appreciated.
    Thanks
    Stephen
    The original query was:
    SELECT
    C_STD_COST.MAT, C_STD_COST.LAB, C_STD_COST.OHD, ITEM.PC, BILL_HDR.RATE,
    BILL_SO.SO_SHIP_QTY, BILL_SO.SO_SHIP_EXT_AMT, AR_DOC.CUSTOMER,
    BILL_SO.AR_DOC,
    CUS_LOC.NAME, AR_DOC.CREATED_DATE, MEMO.TOT_ORD_QTY, MEMO.UNIT_PRICE,
    MEMO.BOOK_RATE, AR_DOC.AR_DOC_TYPE, MEMO.MEMO_TYPE, BILL_SO.ITEM
    FROM
    AR_DOC, BILL_HDR, CUS_LOC, BILL_SO, ITEM, MEMO, C_STD_COST
    WHERE
    AR_DOC.AR_CCN=BILL_HDR.AR_CCN AND
    AR_DOC.AR_DOC_TYPE=BILL_HDR.AR_DOC_TYPE AND
    AR_DOC.AR_DOC=BILL_HDR.AR_DOC AND
    AR_DOC.CUSTOMER=CUS_LOC.CUSTOMER AND
    AR_DOC.CUS_AR_LOC=CUS_LOC.CUS_LOC AND
    BILL_HDR.AR_CCN=BILL_SO.AR_CCN AND
    BILL_HDR.AR_DOC_TYPE=BILL_SO.AR_DOC_TYPE AND
    BILL_HDR.AR_DOC=BILL_SO.AR_DOC AND
    BILL_SO.ITEM=ITEM.ITEM (+) AND
    BILL_SO.REVISION=ITEM.REVISION (+) AND
    BILL_SO.AR_DOC=MEMO.AR_DOC (+) AND
    BILL_SO.AR_DOC_LINE=MEMO.MEMO_LINE (+) AND
    BILL_SO.AR_CCN=MEMO.SALES_CCN (+) AND
    BILL_SO.AR_DOC_TYPE=MEMO.MEMO_TYPE (+) AND
    ITEM.ITEM=C_STD_COST.ITEM (+) AND
    ITEM.REVISION=C_STD_COST.REVISION (+) AND
    AR_DOC.CREATED_DATE>=TO_DATE ('30-05-2006 00:00:00', 'DD-MM-YYYY
    HH24:MI:SS') AND
    AR_DOC.CREATED_DATE<TO_DATE ('14-06-2006 00:00:00', 'DD-MM-YYYY
    HH24:MI:SS')
    ORDER BY
    AR_DOC.CUSTOMER, ITEM.PCThe explain plan showed:
    SELECT STATEMENT
    SORT                ORDER BY
    MERGE JOIN          OUTER
    SORT                JOIN
    NESTED LOOPS        OUTER
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS        OUTER
    TABLE ACCESS        FULL              BILL_SO       4
    TABLE ACCESS        BY INDEX ROWID    ITEM          5
    INDEX               UNIQUE SCAN       PK_ITEM           UNIQUE
    TABLE ACCESS        BY INDEX ROWID    BILL_HDR      2
    INDEX               UNIQUE SCAN       PK_BILL_HDR       UNIQUE
    TABLE ACCESS        BY INDEX ROWID    AR_DOC        1
    INDEX               UNIQUE SCAN       PK_AR_DOC         UNIQUE
    TABLE ACCESS        BY INDEX ROWID    CUS_LOC       3
    INDEX               UNIQUE SCAN       PK_CUS_LOC        UNIQUE
    TABLE ACCESS        BY INDEX ROWID    MEMO          6
    INDEX               RANGE SCAN        PK_MEMO           UNIQUE
    SORT                JOIN
    TABLE ACCESS        FULL              COST_ITM      8The views I created were:
    CREATE VIEW C_BILL_DET AS
    SELECT
    AR_CCN, AR_DOC_TYPE, AR_DOC, AR_DOC_LINE, ITEM,
    REVISION, SO_SHIP_QTY, SO_SHIP_EXT_AMT, COST1
    FROM
    BILL_SO
    UNION ALL
    SELECT
    AR_CCN, AR_DOC_TYPE, AR_DOC, AR_DOC_LINE, ITEM,
    REVISION, SHIP_QTY, SHIP_EXT_AMT, COST1
    FROM
      CR_BLSH;
    CREATE VIEW C_BILL_HDR AS
    SELECT
    AR_CCN, AR_DOC_TYPE, AR_DOC, RATE
    FROM
    BILL_HDR
    UNION ALL
    SELECT
    AR_CCN, AR_DOC_TYPE, AR_DOC, RATE
    FROM
    CR_BLHD;The new query is:
    SELECT
    C_STD_COST.MAT, C_STD_COST.LAB, C_STD_COST.OHD, ITEM.PC, C_BILL_HDR.RATE,
    C_BILL_DET.SO_SHIP_QTY, C_BILL_DET.SO_SHIP_EXT_AMT, AR_DOC.CUSTOMER,
    C_BILL_DET.AR_DOC,
    CUS_LOC.NAME, AR_DOC.CREATED_DATE, MEMO.TOT_ORD_QTY, MEMO.UNIT_PRICE,
    MEMO.BOOK_RATE, AR_DOC.AR_DOC_TYPE, MEMO.MEMO_TYPE, C_BILL_DET.ITEM
    FROM
    AR_DOC, C_BILL_HDR, CUS_LOC, C_BILL_DET, ITEM, MEMO, C_STD_COST
    WHERE
    AR_DOC.AR_CCN=C_BILL_HDR.AR_CCN AND
    AR_DOC.AR_DOC_TYPE=C_BILL_HDR.AR_DOC_TYPE AND
    AR_DOC.AR_DOC=C_BILL_HDR.AR_DOC AND
    AR_DOC.CUSTOMER=CUS_LOC.CUSTOMER AND
    AR_DOC.CUS_AR_LOC=CUS_LOC.CUS_LOC AND
    C_BILL_HDR.AR_CCN=C_BILL_DET.AR_CCN AND
    C_BILL_HDR.AR_DOC_TYPE=C_BILL_DET.AR_DOC_TYPE AND
    C_BILL_HDR.AR_DOC=C_BILL_DET.AR_DOC AND
    C_BILL_DET.ITEM=ITEM.ITEM (+) AND
    C_BILL_DET.REVISION=ITEM.REVISION (+) AND
    C_BILL_DET.AR_DOC=MEMO.AR_DOC (+) AND
    C_BILL_DET.AR_DOC_LINE=MEMO.MEMO_LINE (+) AND
    C_BILL_DET.AR_CCN=MEMO.SALES_CCN (+) AND
    C_BILL_DET.AR_DOC_TYPE=MEMO.MEMO_TYPE (+) AND
    ITEM.ITEM=C_STD_COST.ITEM (+) AND
    ITEM.REVISION=C_STD_COST.REVISION (+) AND
    AR_DOC.CREATED_DATE>=TO_DATE ('30-05-2006 00:00:00', 'DD-MM-YYYY
    HH24:MI:SS') AND
    AR_DOC.CREATED_DATE<TO_DATE ('14-06-2006 00:00:00', 'DD-MM-YYYY
    HH24:MI:SS')
    ORDER BY
    AR_DOC.CUSTOMER, ITEM.PCThe explain plan is:
    SELECT STATEMENT
    SORT                ORDER BY
    MERGE JOIN          OUTER
    SORT                JOIN
    NESTED LOOPS
    NESTED LOOPS
    MERGE JOIN
    SORT                JOIN
    NESTED LOOPS        OUTER
    NESTED LOOPS        OUTER
    VIEW                                  C_BILL_DET   4
    UNION-ALL
    TABLE ACCESS        FULL              BILL_SO      9
    TABLE ACCESS        FULL              CR_BLSH      10
    TABLE ACCESS        BY INDEX ROWID    ITEM         5
    INDEX               UNIQUE SCAN       PK_ITEM           UNIQUE
    TABLE ACCESS        BY INDEX ROWID    MEMO         6
    INDEX               RANGE SCAN        PK_MEMO           UNIQUE
    SORT                JOIN
    VIEW                                  C_BILL_HDR   2
    UNION-ALL
    TABLE ACCESS        FULL              BILL_HDR     11
    TABLE ACCESS        FULL              CR_BLHD      12
    TABLE ACCESS        BY INDEX ROWID    AR_DOC       1
    INDEX               UNIQUE SCAN       PK_AR_DOC         UNIQUE
    TABLE ACCESS        BY INDEX ROWID    CUS_LOC      3
    INDEX               UNIQUE SCAN       PK_CUS_LOC        UNIQUE
    SORT                JOIN
    TABLE ACCESS        FULL              COST_ITM     8

    I don't understand.
    I try your with statement and get: "end_date" invalid identifier as an error
    I start my query out:
    WITH start_date as
    (select to_date ('08/15/2007 12:00:00 AM','MM/DD/YYYY HH:MI:SS AM') from dual),
    end_date as (select to_date ('08/18/2007 12:00:00 AM','MM/DD/YYYY HH:MI:SS AM) from dual)
    select sales.id, start_date as callstart, end_date as callend
    where sales.created_timestamp >= start_date
    and sales.created_timestamp < end_date
    UNION ALL
    <<<<<<<here is where you take the last select statement and replace sales with manufacturing>>>>>>>>>>>>>
    UNION ALL
    <<<<<<<here is where you take the last select statement and replace sales with engineering>>>>>>>>>>>>>
    and it still fails.

  • Value of the start in the Select with in a Hierarchical Query

    Exist any way for put in the select the value of the start with in a Hierarchical Query?
    An example:
    I'll need sth like
    CTH@> select n code, level, np code_parent, 1 code_first_parent
    2 from demo
    3 start with n=1
    4 connect by np = prior n
    5 ;
    CODE LEVEL CODE_PARENT CODE_FIRST_PARENT
    1 1 1
    2 2 1 1
    3 3 2 1
    4 4 3 1
    5 5 4 1
    6 6 5 1
    7 7 6 1
    8 8 7 1
    9 9 8 1
    10 10 9 1
    -- Naturally it couldn´t be a constant value
    The query
    select n,d, level nivel
    , np, prior n
    from demo
    start with n=1
    connect by np = prior n
    --Table and inserts
    create table demo
    ( n number,
    d varchar2(5),
    np number);
    insert into demo values (1,'A', null);
    insert into demo values (2,'B',1);
    insert into demo values (3,'C',2);
    insert into demo values (4,'D',3);
    insert into demo values (5,'E',4);
    insert into demo values (6,'F',5);
    insert into demo values (7,'G',6);
    insert into demo values (8,'H',7);
    insert into demo values (9,'I',8);
    insert into demo values (10,'J',9);
    insert into demo values (11,'K', null);
    insert into demo values (12,'L',11);
    insert into demo values (13,'M',12);
    insert into demo values (14,'N',13);
    insert into demo values (15,'O',14);
    insert into demo values (16,'P',15);
    Message was edited by:
    cth

    On 10g
    connect_by_root(n)Best regards
    Maxim

  • Help with a union all statement

    Hello
    I am pulling a query much like this:
    (select ID, Created_timestamp from snapshot1
    where created_timestamp >= to_date ('8/15/2007 12:00:00 AM','MM/DD/YYYY HH:MI:SS AM')
    and created_timestamp < to_date('8/18/2007 12:00:00 AM','MM/DD/YYYY HH:MI:SS AM'))
    UNION ALL
    (select ID, created_timestamp from snapshot2
    where created_timestamp >= to_date ('8/15/2007 12:00:00 AM','MM/DD/YYYY HH:MI:SS AM')
    and created_timestamp < to_date('8/18/2007 12:00:00 AM','MM/DD/YYYY HH:MI:SS AM'))
    UNION ALL
    (select ID, created_timestamp from data_history
    where created_timestamp >= to_date ('8/15/2007 12:00:00 AM','MM/DD/YYYY HH:MI:SS AM')
    and created_timestamp < to_date('8/18/2007 12:00:00 AM','MM/DD/YYYY HH:MI:SS AM'))
    Is there an easier way to handle created_timestamp?
    I would like to put it at the beginning so I only have to change it in one place.

    I don't understand.
    I try your with statement and get: "end_date" invalid identifier as an error
    I start my query out:
    WITH start_date as
    (select to_date ('08/15/2007 12:00:00 AM','MM/DD/YYYY HH:MI:SS AM') from dual),
    end_date as (select to_date ('08/18/2007 12:00:00 AM','MM/DD/YYYY HH:MI:SS AM) from dual)
    select sales.id, start_date as callstart, end_date as callend
    where sales.created_timestamp >= start_date
    and sales.created_timestamp < end_date
    UNION ALL
    <<<<<<<here is where you take the last select statement and replace sales with manufacturing>>>>>>>>>>>>>
    UNION ALL
    <<<<<<<here is where you take the last select statement and replace sales with engineering>>>>>>>>>>>>>
    and it still fails.

  • Ordering in Union All Query

    Hi,
    Is Order by in Union ALL query allowed? If not what is the solution while using Unoin ALL?
    thx

    What isn't working? These are all OK:
    SELECT dummy FROM dual
    UNION ALL
    SELECT dummy FROM dual
    ORDER BY dummy;
    SELECT dummy FROM dual
    UNION ALL
    SELECT dummy FROM dual
    ORDER BY 1;
    SELECT dummy AS c1 FROM dual
    UNION ALL
    SELECT dummy FROM dual
    ORDER BY c1;The name used in the ORDER BY clause has to be one of the names in the first SELECT list, or a number.

  • Union All query help

    Hi,
    I have a union all query like this :
    select a.prod_id,count(a.app_id) as noofapplications from enrollment a,attest b
    where a.e_id=b.e_id group by a.prod_id
    union all
    select a.prod_id,count(a.app_id) as noofapplications from data_feed x,prod_feed y
    where x.agent_num=y.prod_id group by y.prod_id
    I get the results something like this :
    prod_id noofapplications
    x1824787 2
    y397458 4
    y397458 3
    r457868 3
    i876247 6
    In below results y397458 is showing twice since it results from both the queries .But i want a single result like this :
    prod_id noofapplications
    x1824787 2
    y397458 7
    r457868 3
    i876247 6
    For y397458 it should add 4+3 and the result should be displayed one time only .
    Please help ..
    Thanks in Advance

    Slightly reorder your query text:
    select prod_id,count(app_id) as noofapplications
    from
    select a.prod_id,a.app_id
    from enrollment a,attest b
    where a.e_id=b.e_id
    union all
    select a.prod_id,a.app_id
    from data_feed x,prod_feed y
    where x.agent_num=y.prod_id
    group by prod_id
    /

  • Add data to the table in the database with the use of add button

    The name of my database is Socrates.
    The name of the table in the database is Employees
    I want to be able to add data to the database. i am presently working on the add button such that when i enter date into the textfield and press the add button it should automatically register in the table.
    The error upon compilation is with this line of code
    If (ae.getSource() == jbtnA)// it says that ";" is expected
    Below is the entire code
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Mainpage extends JFrame implements ActionListener
         JTextField jFirstName = new JTextField(15);
         JTextField jSurname = new JTextField(12);
         JTextField jCity = new JTextField(10);
         JTextField jCountry = new JTextField(12);
         JTextField jSSN = new JTextField(8);
         JLabel jFirstLab = new JLabel("First Name");
         JLabel jSurnameLab = new JLabel("Surname");
         JLabel jCityLab = new JLabel("City");
         JLabel jCountryLab = new JLabel("Country");
         JLabel jSSNLab = new JLabel("Social Security Number (SSN)");
         JButton jbtnA = new JButton ("Add");
         JButton jbtnPrv = new JButton ("Previous");
         JButton jbtnNt = new JButton ("Next");
         JButton jbtnDl= new JButton ("Delete");
         JButton jbtnSrch = new JButton ("Search");
         public Mainpage (String title)
              super (title);
              Container cont = getContentPane();
              JPanel pane1 = new JPanel();
              JPanel pane2 = new JPanel();
              JPanel pane3 = new JPanel();
              pane1.setLayout (new GridLayout (0,1));
              pane2.setLayout (new GridLayout(0,1));
              pane3.setLayout (new FlowLayout());
              pane1.add(jFirstLab);
              pane1.add(jSurnameLab);     
              pane1.add(jCityLab);
              pane1.add(jCountryLab);
              pane1.add(jSSNLab);
              pane2.add(jFirstName);
              pane2.add(jSurname);
              pane2.add(jCity);
              pane2.add(jCountry);
              pane2.add(jSSN);
              pane3.add(jbtnA);
              pane3.add(jbtnPrv);
              pane3.add(jbtnNt);
              pane3.add(jbtnDl);
              pane3.add(jbtnSrch);
              cont.add(pane1, BorderLayout.CENTER);
              cont.add(pane2, BorderLayout.LINE_END);
              cont.add(pane3, BorderLayout.SOUTH);
              jFirstName.addActionListener(this);
              jSurname.addActionListener(this);
              jCity.addActionListener(this);
              jCountry.addActionListener(this);
              jSSN.addActionListener(this);
              jbtnA.addActionListener(this);
              jbtnPrv.addActionListener(this);
              jbtnNt.addActionListener(this);
              jbtnDl.addActionListener(this);
              jbtnSrch.addActionListener(this);
              validate();
              setVisible(true);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              pack();
              setResizable(false);
         public void actionPerformed(ActionEvent ae)
                   If (ae.getSource() == jbtnA)
                                    fst = jFirstName.getText();
                        srn = jSurname.getText();
                        cty = jCity.getText();
                        cnty = jCountry.getText();
                        int sn =
    Interger.parseInt(jSSN.getText());
                                    String ad = "Insert into Employees
    (Firstname,Surname,City,Country,SSN)" +
    "values('"fst"','"srn"','"cty"','"cnty"','"sn"')";
                        Statement stmt = con.createStatment();
                        int rowcount = stmt.executeUpdate(ad);
                        JOptionPane.showMessageDialog("Your
    details have been registered");
                        Statement stmt = con.createStatment();
                        int rowcount = stmt.executeUpdate(ad);
    public static void main (String args[])
              Mainpage ObjFr = new Mainpage("Please fill this
    registration form");
              try
                   Class.forname("sun.jdbc.odbc.JdbcOdbcDriver");
                   String plato = "jdbc:odbc:socrates";
                   Connection con =
    DriverManager.getConnection(plato);
              catch(SQLException ce)
                   System.out.println(ce);
    }

    i have restructured the code, but the following line of code is giving error:
    String plato = jdbc:odbc:socrates;
    the entire code is below:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    public class Mainpage extends JFrame implements ActionListener
         JTextField jFirstName = new JTextField(15);
         JTextField jSurname = new JTextField(12);
         JTextField jCity = new JTextField(10);
         JTextField jCountry = new JTextField(12);
         JTextField jSSN = new JTextField(8);
         JLabel jFirstLab = new JLabel("First Name");
         JLabel jSurnameLab = new JLabel("Surname");
         JLabel jCityLab = new JLabel("City");
         JLabel jCountryLab = new JLabel("Country");
         JLabel jSSNLab = new JLabel("Social Security Number (SSN)");
         JButton jbtnA = new JButton ("Add");
         JButton jbtnPrv = new JButton ("Previous");
         JButton jbtnNt = new JButton ("Next");
         JButton jbtnDl= new JButton ("Delete");
         JButton jbtnSrch = new JButton ("Search");
         Statement stmt;
            String ad;
            public Mainpage (String title)
              super (title);
              Container cont = getContentPane();
              JPanel pane1 = new JPanel();
              JPanel pane2 = new JPanel();
              JPanel pane3 = new JPanel();
              pane1.setLayout (new GridLayout (0,1));
              pane2.setLayout (new GridLayout(0,1));
              pane3.setLayout (new FlowLayout());
              pane1.add(jFirstLab);
              pane1.add(jSurnameLab);     
              pane1.add(jCityLab);
              pane1.add(jCountryLab);
              pane1.add(jSSNLab);
              pane2.add(jFirstName);
              pane2.add(jSurname);
              pane2.add(jCity);
              pane2.add(jCountry);
              pane2.add(jSSN);
              pane3.add(jbtnA);
              pane3.add(jbtnPrv);
              pane3.add(jbtnNt);
              pane3.add(jbtnDl);
              pane3.add(jbtnSrch);
              cont.add(pane1, BorderLayout.CENTER);
              cont.add(pane2, BorderLayout.LINE_END);
              cont.add(pane3, BorderLayout.SOUTH);
              jFirstName.addActionListener(this);
              jSurname.addActionListener(this);
              jCity.addActionListener(this);
              jCountry.addActionListener(this);
              jSSN.addActionListener(this);
              jbtnA.addActionListener(this);
              jbtnPrv.addActionListener(this);
              jbtnNt.addActionListener(this);
              jbtnDl.addActionListener(this);
              jbtnSrch.addActionListener(this);
              validate();
              setVisible(true);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              pack();
              setResizable(false);
              try
                   Class.forname(sun.jdbc.odbc.JdbcOdbcDriver);
                   String plato = jdbc:odbc:socrates;
                   Connection con = DriverManager.getConnection(plato);
                   stmt = con.createStatment();
              catch(SQLException ce)
                   System.out.println(ce);
              catch(ClassNotFoundException ce)
                   System.out.println(ce);
         public void actionPerformed(ActionEvent ae)
                   try
                        if(ae.getSource().equals(jbtnA))
                                         fst = jFirstName.getText();
                             srn = jSurname.getText();
                             cty = jCity.getText();
                             cnty = jCountry.getText();
                             int sn = Interger.parseInt(jSSN.getText());
                                         ad = "Insert into Employees
    values('"+fst+"',"+srn+"','"+cty+"','"+cnty+"','"+sn+"')";
                             stmt.executeUpdate(ad);
                             JOptionPane.showMessageDialog(this, "Your details have been
    registered");
                   catch(SQLException ce)
                        System.out.println(ce);
    public static void main(String args[])
              Mainpage ObjFr = new Mainpage("Please fill this registration form");
    }

  • How to load data to fact table for the year 2008 without modifying session sql

    Hi,
    I need to load data to OOTB Financial-General ledger related fact tables using new DAC execution plan for the year 2008 (just for the year 2008 not before or after). without modifying OOTB informataica session SQL. do you know how to do it?
    appreciate you for your help. thank you.

    Do you know why you are going for new Execution plan instead of using existing?
    let me know this will share what I know
    thanks for checking
    PS: JV its you!!
    Message was edited by: SriniVEERAVALLI

  • To group the data by checking the year

    I need to design a report with details based on year.i have employee details with their date of join.I want to display the fields by grouping the year alone.For eg employees joined in the year 2000,2001,2002 etc.Like this i have to display.How to check the year alone?(not like getting date as input)

    You can extract  year from the filed 'date of join ' and put it in another internal table together with employee id . and sort the internal table by year . you can use this sorted internal table for printing

  • How to get row index of data table in the while ValueChangeListener fired?

    Hi,
    i have a data table in my page, which contains various components like inputText, selectOneChoice in each row.
    i am invoking a method ValueChangeListener attribute of the selectOneChoice component. I have given the autoSubmit=true for this component.
    <tr:selectOneChoice id="ratingModelType"
    value="#{childRatio.ratingModelType}" binding="#{pageManager.form.bindRatioType}"
    valueChangeListener="#{pageManager.form.onRatingModelTypeChange}" autoSubmit="true"
    contentStyle="width:150px" required="#{!childRatio.disableChildRatioRatingModelType}"
    requiredMessageDetail="#{appBundle['error.ratingModelTypeShouldNotBeEmpty']}">
    <f:selectItems value="#{pageManager.catalog['Rating Model Type']}" />
    <tr:selectOneChoice>In that method i want to fetch the map(with all updated values) relevant to the currently modified row of the table.
    Since i am not using the selectionListener or any radio buttons in the page i am not able to get the row index of the table.
    somebody please tell me how to get the row index of the table, while ValueChangeListener fired?
    Thanks in advance.
    Subbu

    Hi niki,
    Thank you so much. With your suggestion i got the result exactly what i want.
    thanks again.
    --subbu                                                                                                                                                                                                                               

  • Spread Data Over Multiple Months & Years with Data from Multiple Years

    Hello Everyone,
    I have a complex calculation for spreading values over several months spanning mulitle years. Because we have a 36 month rolling Forecast, a more sophisticated calc is required as opposed to hard coding months or years.
    Heres the description:
    Users enter the following data,
    FY11     BegBalance     Number of BOD Members     10
              BOD Options Vesting Months     20
              BOD Options Accounting Value     10
              BOD Options- Number of Shares     100
              BOD Grant Month     Aug
    FY12     BegBalance     Number of BOD Members     5
              BOD Options Vesting Months     10
              BOD Options Accounting Value     5
              BOD Options- Number of Shares     200
              BOD Grant Month     Oct
    FY13     BegBalance     Number of BOD Members     20
              BOD Options Vesting Months     8
              BOD Options Accounting Value     20
              BOD Options- Number of Shares     100
              BOD Grant Month     Feb
    Based on the above;
    "BOD Stock" is calculated as following/month=Number of BOD Members*BOD Options Accounting Value*BOD Options- Number of Shares/ BOD Options Vesting Months
    Start month for the above is based on "BOD Grant Month". So, for instance considering data for FY11:
    The total "BOD Stock" value is $10000 (originating from FY11) with start month of AUG in FY11 and the number of months to spread over is 20 months. So, essentially the "BOD Stock" per month (originating from FY11) is $500 starting from AUG FY11 to Mar FY13.
    Similarly, the total "BOD Stock" value is $5000 (originating from FY12) with start month of OCT in FY12 and the number of months to spread over is 10 months. So, essentially the "BOD Stock" per month (originating from FY12) is $500 starting from OCT FY12 to JUL FY13.
    The challange I am facing is because of the number of months to spread. Because I have data to spread from multiple years and each year's data spills into the following years, each year should accumulate data from prior years. For instance;
    FY11 should include only FY11
    FY12 should include FY11 and FY12
    FY13 should include FY11, FY12 and FY13.
    Could anyone suggest a smarter way to do this without writting code for each year, maybe using @MDALLOCATE function? The following shows how data should be spread and accumulated.
                             BegBalance     Jan     Feb     Mar     Apr     May     Jun     Jul     Aug     Sep     Oct     Nov     Dec     Period
    FY11     Number of BOD Members          10     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options Vesting Months          20     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options Accounting Value     10     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options- Number of Shares     100     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Grant Month               Aug     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
              BOD Stock               10000     #mi     #mi     #mi     #mi     #mi     #mi     #mi     500     500     500     500     500     #mi
    FY12     Number of BOD Members          5     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options Vesting Months          10     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options Accounting Value     5     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options- Number of Shares     200     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Grant Month               Oct     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
              BOD Stock               5000     500     500     500     500     500     500     500     500     500     1000     1000     1000     #mi
    FY13     Number of BOD Members          20     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options Vesting Months          8     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options Accounting Value     20     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Options- Number of Shares     100     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
         BOD Grant Month               Feb     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi     #mi
              BOD Stock               40000     1000     6000     6000     5500     5500     5500     5500     5000     5000     #mi     #mi     #mi     #mi
    Appreciate your inputs!
    Edited by: user10678366 on Oct 12, 2010 3:21 PM

    Why not use substitution variables for Years? you could have something like &Year1, &Year2, &Year3
    Cheers

  • Data table to the data chart editor ?

    It is possible to link the values of a table to the data chart editor ? Not to copy and paste.

    sw_mero
    Welcome to the forum.
    Unfortunately not.
    Like many things in Pages, it is a bit of a hood ornament. It looks good in the demo but when you get to grips with it, it is not quite all there. Maybe in the next version of Pages.
    What you can do is copy and paste a chart created in Numbers, which will retain the links to the data in Numbers. Just make sure you save both the data and the Numbers file first.
    Peter

  • Data table for the ratings and feedback of the file

    User provide feedback and rate the file posted in portal
    Where are these detail stored and which table. This is required to generate report the feedbacks and rating of all files posted in a folder.
    Sasikala G C

    Ratings can be displayed one-track at a time, by topping on the title in the detailed view. BPMs can be displayed only in iTunes on your computer. Perhaps you could utilize Smart Playlists to group your tracks according to these criteria?
    You can request features, point out bugs, etc, at Apple Feedback pages.

  • OAF Export button fetching data in one column - view object using union all

    Dear All,
    Export button showing data in one column from  view object,
    View object is based on mulitple queries with union all ,
    Please let me know the solution for this issue.
    Thanks
    Maheswara Raju

    Maheswara Raju,
    As per my understanding you are not able to export all the View Attribute using export Button. Only the attribute which is used with the item/region will get exported.
    There are few work around in case if you want to export the column without showing on OAF Page. Let me know.
    Cheers
    Gyan

Maybe you are looking for

  • Transfer Playlists & Music from old Ipod to new one - Shared ITunes

    I have just bought a new ipod nano and want to transfer the music and playlists from my old 2nd generation ipod over. Unfortunately I share a computer and the library in ITunes isn't mine. I can connect both old and new ipods at the same time but obv

  • Java.rmi.RemoteException: [Deployer:149150]An IOException occurred while re

    Hi All, I am getting below error in logs, is any body has faced this problem ? <28.06.2011 13:33 Uhr GMT> <Warning> <Deployer> <ADFBDFEFRM> <BD_AdminServer> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel

  • Please help, sorting...

    I have to sort a doubly linked list containing strings I have to hard code a merge sort for this, but I have nooooo idea how to do this... I know what a merge sort is, and how to do it with an int array, but string? and even worse, not an array but a

  • CMS - Items remain "Waiting for assembly", even after succesfull assembly

    When we assemble components in the Integration Directory track, the assembly is succesfull and the components appear in the approval tab. But... the components remain in the assembly tab with state "Waiting for assembly" (there are also corresponding

  • Problem of displaying JPEG images

    I just got my new Power Mac G5 computer. I am Also new to the MAC world. I put in a CD, which is filled with all JPEG files, into my DVD drive. From the desktop, I double click the CD icon; no problem, I saw all the JPEG files. I then tried to view t