How to create view on dates for a given month for matrix

hi all
i have the following 2 tables
Task_Master
Task_ID
Task_Name
Task_Details
Task_ID
Task_Date
Task_Count
Both the tables are linked through primary and foreign keys...just want to create a view where i will provide only month and it will return the days like 1-Oct....2-Oct....3-Oct....4-Oct.....5-Oct.... and the Task_Count value under it ..INPUT IS AS FOLLOWS
01/01/2010 How many ATM's issued Today 20
01/02/2010 How many cheque books issued Today 50
01/03/2010 How many cross cheques Today 50
Result required
Task.....................1-Jan..........2-Jan..........3-Jan.........4-Jan........31-Jan
Atms Issued ..........20..............20..............10..............50..............1
Chequebooks.........34..............56................67.............0................67

Hi,
That's called a Pivot , and here's one way to do it:
WITH     start_date     AS
     SELECT     TO_DATE ( '01-Jan-2010'
               , 'DD-Mon-YYYY'
               )     AS start_date
     FROM     dual
SELECT       m.task_name
,       SUM (CASE WHEN TO_CHAR (d.task_date, 'DD') = '01' THEN 1 END)     AS Day_1
,       SUM (CASE WHEN TO_CHAR (d.task_date, 'DD') = '02' THEN 1 END)     AS Day_2
,       SUM (CASE WHEN TO_CHAR (d.task_date, 'DD') = '03' THEN 1 END)     AS Day_3
,       SUM (CASE WHEN TO_CHAR (d.task_date, 'DD') = '31' THEN 1 END)     AS Day_31
FROM       task_master     m
JOIN       task_detail     d     ON     m.task_id     = d.task_id
JOIN       start_date     s     ON     d.task_date     >=            s.start_date
                    AND     d.task_date     < ADD_MONTHS (s.start_date, 1)
GROUP BY  m.task_name
;As posted, this woirks is Oracle 9 (and up).
Starting in Oracle 11, you can also use the SELECT ... PIVOT feature, which is better.

Similar Messages

  • How to create view for xmltype table in oracle

    hi:
    Can some one help me how to create view for xmltype table in oracle?
    XMLType do not have column
    Sem

    Thank you !!
    I read it and become very hard to implement what I want to do.
    Can you give me example please?
    My main goal to create view for xmltype table is to XQuery the XML data?
    Do you have any other suggestion?
    Please help
    Ali_2

  • How to create customer master data for walking customer in retail

    hi experts !!!!!!
    for retail industry e.g books trading industry
    how to create customer master data for walking customer in retail
    its dummy or one time customer
    if i create one time customer then same customer number can i use for every new order and every new customer how ?????
    thanks

    Dear Hanumant,
    As per my view,,
    You can use one time customer functionality to full fill your requirement.
    When you create sales order with one time customer system take you to the customer data maintanence screen through that you can maintain the one time customer data.
    Same one time customer number you can use for every new order through maintaining different data.
    I hope this will help you,
    Regards,
    Murali.
    Edited by: Murali Mohan.Tallapaneni on Dec 19, 2008 6:08 AM

  • How to create a ABAP report off of SRM box for live data?

    How to create a ABAP report off of SRM box for live data?
    Thanks in advance.
    York.

    you can try infoset query:
    STEP - A:
    1. Go to T Code RSQ02 and give the InfoSet name & select CREATE.
    2. Provide the Name(Description) and Data Source i.e. for eg here i take "DIRECT READ OF TABLE" = /BIC/AODS100. Then CONTINUE.
    3. Select what to Include in the 3 options available with the POPUP, here "INCLUDE ALL TABLE FIELDS". Then Check the fields and click GENERATE(one RED and WHITE round icon).
    4. Now provide the PACKAGE for the INFOSET. Come Back(F3).
    STEP - B: optional(If u want to create a new user group)
    1. Select ENVIRONMENT -> USER GROUPS. Provide the User Group name and CREATE.
    2. Provide Description and SAVE.
    3. Provide PACKAGE and SAVE. Come Back (F3) to the Initial Screen.
    4. Click Role/User Group Assignment. Select Newly Created User Group or an existing one. Then SAVE (CTRL + S). F3.
    STEP - C:
    1. Select ENVIRONMENT -> Queries. Provide the query name and CREATE.
    2. Select the INFOSET u have created and assigned the user group.
    3. Provide the Title and Select BASIC LIST. There you have to select (check) the fields you want to display, SAVE and then TEST. It will ask for Variant, just CONTINUE.

  • How to create generic master data  datasource .

    How to create generic master data  datasource which utilises ALE change pointers for extraction of master data.

    Hi,
    For any master data lets say, Material Master, for this you need to create a view
    based on your requirement by selecting one or more tables into your view and
    keeping all the required fields in the view as viewfields and go to RS02 create
    generic data source, select the view option as source and put the view, save and
    activate, at the same time set the delta pointer as to whether Numericpointer/date/timestamp..this way you can create a generic DS then transfer the stru. and at the BW side replicate the source system..and so on..
    Hope this helps..
    Assign points if useful.
    Need further info revert..
    Cheers,
    Pattan.

  • How to created a Report to calculate On-Hand inventory for pending sales

    hi,
        how to  created a Report to calculate On-Hand inventory for pending sales orders.for this report what are the tables and fields we have to use give me sample report.
    thank you
    radhakrishna.

    Hi!
    Tables:
    VBAK - sales order header data
    VBAP - sales order position data
    VBUK - sales order status header data
    VBUP - sales order status position data
    VBELN field is the key between the tables.
    Statuses in tables VBUK, VBUP: A-uncompleted, B-partially completed, C-fully completed
    Regards
    Tamá

  • How can i view the data from Access DB in oracle

    pls tell me that how can i view the data of MS ACCESS DATABASE in ORACLE.i was use ODBC of ACCESS DATABASE AND THEN CREATE DATABASE LINK IN ORACLE BUT NOT YET SUCCEEDED.PLS TELL ME THE PROCEDURE.
    regard's

    hi,
    u nedd to use Oracle Hetrogeneous Services,,
    full details of the procedure u may fing on metalink
    Regards

  • How to create and up date infostructure?

    Hi,
    Can any body tell us how to create and upload data to info structure?
    regards,
    N.Nagaraju

    Hi,
    For maintenance of Infostructures the T-Code is LBWE.
    There you can chage the structure by clicking on Structure Maintenance.
    For creation of InfoSources the T-Code is RSA1.
    Thanks,
    Amit.

  • How can I view the contents of a free trial for adobe fireworks cs6 on mac

    how can I view the contents of a free trial for adobe fireworks cs6 on mac.
    My friend told me to find the application in finder then hit control and click it and then it should give you the option to click
    "view package contents"
    This was not the case
    please help thank you

    When posting in Apple Communties/Forums/Message Boards.......It would help us to know which iMac model you have, which OS & version you're using, how much RAM, etc. You can have this info displayed on the bottom of every post by completing your system profile and filling in the information asked for.
    CLICKY CLICK---> https://discussions.apple.com/docs/DOC-3602
    CLICKY CLICK-----> Help us to help you on these forums

  • How to create 3.x data source in bi 7

    Hi Guys,
                 can anyone tell me<b> how to create 3.x data source(emulated) in bi 7.0 </b>
    pls reply  me this is urgent
    ravi

    Ravi,
    Please do not multiply the same question several times. The answer is given in the other replica:
    how to create 3.x filesystem data source(emulated) in bi 7.0

  • How to create a sub head(code) in a catalog- for service notification

    Hi everyone,
    How to create a sub head(code) in a catalog- for service notification?
    Please guide with your valuable comments.
    Please guide its very urgent.
    Thanks and Regards
    Edited by: MPVash Vash on Oct 24, 2008 8:14 AM
    Edited by: MPVash Vash on Oct 30, 2008 7:38 AM

    Hi,
    Go to T-code QS41, give the catalog and code group and enter.
    U can click on the code after selecting the code group and create new  codes.
    In SPRO u should see which type of catalog is assigned to the notification type. This u can see in the overview of the notification type by selecting the notification type in SPRO.
    Regards
    Haricharan

  • Looking for formula to fill dates of particular days of week for a given month

    Hi
    I have a Numbers document with a sheet for each month of the year, named "January", "February", "March", etc.
    Each sheet contains a table as follows:
    I am looking for a function that will calculate the dates in a given month that I am due to see each client, based on the year (contained in a single cell table on a seperate sheet) and the month of the sheet (I am presuming that a function can refer to the name of a sheet).  These dates would populate the cells under "Session 1", "Session 2", etc. (for some days of the week there may be only four sessions, for others five).
    I hope this is clear, and would be grateful for any help in getting this working.
    Thanks,
    Nick

    Here's an example, using September, 2011 as the month.
    Main Table:
    A1: =DATE(Year :: A2,9,1)
    This calculates the Date and Time value for midnight at the beginning of the first day of the ninth month of the year indicated in cell A2 of the table "Year" (September 1, 2011). It uses a Custom format to display only the month and year of this date. The Dates calculated in the rest of the table depend on the Date and Time value in this cell.
    A2 - A11: Entered data. Not used in calculations.
    B2 - B10: Entered data. The text values here are used as search-for values, and must match the text values in column A of the table Weekday lookup.
    C2, Filled down to C10: =$A$1+MOD(7-WEEKDAY($A$1)+VLOOKUP(B,Weekday lookup :: $A:$B,2,FALSE),7)
    This calculates the Date corresponding to the first occurrence of the weekday indicated in B during the month in A1. The result is a Date and Time value (used in formulas to the right). The cells use a custom format to display only the Day (of the month) number.
    D2, Filled right to column F and down to row 10: =C+7
    Calculates the date seven days after the date in column C.
    G2, filled down to row 10: =IF(MONTH($A$1)=MONTH(F+7),F+7,"")
    This is the same formula as used in D2, but adds a check to suppress the calculation if the result is not in the same month as other dates on the table.
    Year: The requested single cell table to record the year.
    Weekday Lookup: A lookup table from which to retrieve the weekday number for the day in column B of the main table.
    Custom formats:
    Select cells C2 - G10
    Open the Inspector > Cell Format Inspector > Date and Time
    Delete the unwanted elements from the workspace in the Inspector.
    Repeat for cell A1.
    Regards,
    Barry
    PS: Numbers cannot use the Sheet name or Table name as data for a formula unless the name is placed into a cell on a table.
    B

  • How to access the Custom Data type variable given in Expression edit control To and From LabVIEW

    Hello, I would like to know how to access the custom data type variable given in the Espression Edit Control from LabVIEW and vice-versa
    Say, the FileGlobals.Reference_Handle (Custom Data Type Variable) contains the
    VISA I/O session (Which in turn contains VISA_DeviceName: String, Session: Number),
    Channel1: Number and
    Channel2: Number
    I am expecting the user to give FileGlobals.Reference_Handle as the input at the ExpressionEdit Control in the edit screen of the VI Call.
    I would like to know how to get the values of this custom data type to LabVIEW?
    Say, if I have the Cluster in LabVIEW like VISA I/O session (Deive Name and Session Number), Channel1 and Channel2
    how do i need to set this cluster to the Custom Data type variable in TestStand?
    Thanks and Regards
    Prakash 

    Hi,
    TestStand to LabVIEW: i didnt understand what you r trying to achieve. But if you are using references, Use Property nodes and Invoke nodes to achieve what you want in LabVIEW.
     LabVIEW to TestStand: check the image below: You need to click the button next to 'container'. I have used a cluster output in the VI.
    Hope this helps
    .......^___________________^
    ....../ '---_BOT ____________ ]
    ...../_==O;;;;;;;;_______.:/
    Attachments:
    1.JPG ‏187 KB

  • Calculate Avg  for the given months based on the no. of days in months

    Dear Experts
    I  have a report in which there is a characterictic claenderyr/month.The Input paramter is claenderyr/month which is restricted by a variable of type interval. i mean user will enter calenderyr/month as interval say 012010 to 06.2010. Now I have to calculate Avg sale Qty for the given months based on the no. of days for the given range of months. How I can achieve this in BW Query. Pl. advice
    Dinesh Sharma

    Hi,
    Create formula for the sales qty.
    maintain the exception aggregation as average based on calday
    Best Regards,
    M.H.REDDY

  • No of days elapsed for a given month

    Hello,
    I am trying to find number of days elased for a given month. How do I write this in CMOD.
    My input variable is CALMonth/Year  - 06/2010. If I run the report today, I should get numbers of days up to today. Please advise.
    thanks for your help in advance.
    AG..

    Following thread might help you with this
    No. of days in a month

Maybe you are looking for

  • Photoshop Refine Edge Tool questions

    I made a Quick Selection of a person and am using the Refine Edge tool with the goal of extracting the person from the image so I can place her somewhere else. I set the Smart Radius box, and Radius to about 2, smoothness to about 9, and then I take

  • Parsing xml with dom4j - cannot find jar file

    Hi, I'm using Jdeveloper 10g and tomcat 5.5.9. I have a servlet which calls a java class (ParseXML.java) that trys to parse an xml string using dom4j. A snippet of ParseXML.java... import org.dom4j.Document; import org.dom4j.DocumentException; import

  • Newbie Please Help!

    Is there a way in which I can run the following program from within an HTML web site. The code is from /* From http://java.sun.com/docs/books/tutorial/index.html */ However I have changed some of it and wish to run it from within a web-site I am buil

  • OEL4 64bit and 9i DB

    Dear Experts I am using Oracle Enterprise Linux 4 update 8 x86_64bit. After installing compat-libcwait-2.1-1.i386.rpm i am facing following error at every command. Oracle 9i successfully installed. please suggest me the way to get rid of this error.

  • Need  templates  of standard queries out put.

    hai i need templates of standerd purchasing  queries (exel output) . ie  query result in excel.