Get duplicates in the case and Count clause in the generation of reports

Hi all

Let me explain first Base (just the Section that is in the scope of the present code) then evil go to code and my problem.i have a Set of pre-defined tasks in * 'TASK' * Table.i have a system that puts the user's request by assigning the task to their request to Request.Each will be mapped to the Instance of the task (predefined) , it will remain in a separate table * "TASK_INSTANCE" * against the user of the application id. Each task has a predefined duration.and, that their maturity date is stored in the Time Stamp data type column.

My scenario is I need to generate report based the date.report requirement is complete, I need get the number of tasks that have the date of completion as today, tomorrow and the next day they grouped based on task names.

My problem is, im getting duplicates if I used separate. It is not possible to duplicate using the join because im using Group by task nameevery record in the Task_instance table has direct relationship with the task ID. For example: im getting a line with the County satisfying the Condition and the next row with empty set.i he cannot understand why happening.need your help to understand this.

Let me add the query below,

SELECT task.task_name,
* (CASE *)
WHEN ((TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)) =
(- 1).
THEN
* (COUNT (task_instance.ptd_pdd_date)) *.
END)
AS "1_day_behind."
* (CASE *)
WHEN ((TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)) =
(- 2).
THEN
COUNT (task_instance.ptd_pdd_date)
END)
AS "2_day_behind."
* (CASE *)
WHEN ((TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)) =
(- 3).
THEN
COUNT (task_instance.ptd_pdd_date)
END)
AS "3_day_behind".
The TASK task_instance
WHERE task.task_id = task_instance.task_id
AND task_instance.status_id = 1
AND task_instance.ptd_pdd_date IS NOT NULL
GROUP BY (TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)),
Task.Task_Name;


task_instance.status_id = 1 refers to the task located in "in progress".


It's overall results (example) I get. In this area, the UI_Contact_Customer task is repeated three times. features of different in separate lines and null in the line separate .i need to avoid these duplicates.please Advisor.

__________________________________________________________________________________
TASKNAME | "1_DAY_BEHIND" | "2_DAY_BEHIND" | "3_DAY_BEHIND" |
______________________________|________________|_________________|_________________|
UI_Conduct_Fiber_Plant_Survey___ | ___ | ___ | ___ |
UI_Conduct_Site_Survey___ | ___ | ___ | ___ |
UI_ConductFiberSurvey_C___ | ___ | ___ | ___ |
UI_ConductSiteSurvey_C _ | ___ | ___ | ___ |
UI_Contact_Customer_____________|________________|_________________|_________________|
_ UI_Contact_Customer | ___10___ | ___ | ___ |
UI_Contact_Customer___ | ___ | ___ 12___ | ___ |
UI_Create_Account_Equip_C___ | ___ | ___ | ___ |
UI_Create_Account_Equipment___ | ___ | ___ | ___ |
UI_Create_CM_Ticket |     | | |
______________________________|________________|_________________|_________________|

In the above result set, in particular UI_Contact_Customer task, ten of their instance with completion date tomorrow and 12 instance having the next day as the date of completion. I need to get all those as single line without duplicate.




Thank you
Jeevanand.K

Jeevanand K wrote:

I need to generate the report for the following scenarios

So what's the problem:

SELECT  task.task_name,
        COUNT(
              CASE
                WHEN TRUNC(SYSDATE) - TRUNC(task_instance.ptd_pdd_date) = -1 THEN 1
              END
             ) AS "1_day_ago",
        COUNT(
              CASE
                WHEN TRUNC(SYSDATE) - TRUNC(task_instance.ptd_pdd_date) = -2 THEN 1
              END
             ) AS "2_day_ago",
        COUNT(
              CASE
                WHEN TRUNC(SYSDATE) - TRUNC(task_instance.ptd_pdd_date) = -3 THEN 1
              END
             ) AS "3_day_ago",
        COUNT(
              CASE
                WHEN TRUNC(SYSDATE) - TRUNC(task_instance.ptd_pdd_date) = -14 THEN 1
              END
             ) AS "2_weeks_ago",
        COUNT(
              CASE
                WHEN TRUNC(SYSDATE) - TRUNC(task_instance.ptd_pdd_date) < -3 THEN 1
              END
             ) AS "more_than_4_days_ago"
  FROM  task,
        task_instance
  WHERE task.task_id = task_instance.task_id
    AND task_instance.status_id = 1
  GROUP BY task.task_name;

Keep in mind "more_than_4_days_ago" includes tasks as filled with "2_weeks_ago".

SY.

Tags: Database

Similar Questions

  • How to import pictures in the excel worksheet without using the generation of reports

    Dear friends

    I want to know how to import the image or the image file in excel worksheet without using the generation of reports...

    Please come with suggestions or the code example

    Concerning

    Knani

    Please go through the link below

    http://zone.NI.com/DevZone/CDA/EPD/p/ID/3638

    Even if a Subvi is absent I think it will be useful for you.

    Concerning

    Rajesh nawal

  • Activation of Windows7 get error 0xc004c020 "the activation server reported that the Multiple Activation key has exceeded its limit."

    I installed Win7 Pro 64 - bit about 4 - 5 times with the same original key on the same computer, but now I have a problem; When I want to activate key, always error has occurred with this 0xC004C020 with description error Code: the activation server reported that the Multiple Activation key has exceeded its limit. How do I fix this problem?

    Hello

    Please find your resolution from this link: http://technet.microsoft.com/en-us/library/ff793399.aspx

    MAKs by design have a limited number of activations. Contact the Microsoft Activation call center.

    Hope that helps.

    Kind regards

    Joel

  • How to write data I read frequency bands in excellent using the tools for the generation of reports.

    Hi all

    I wrote the code to read data from the Analyzer of spectrum and also for writing in excel using report generation tools. When I run the program values get read and excellent sheet also opens but I don't see anything written in.

    So if anyone can help me in that I'm very gald. I am attaching the screenshot of my program and also attach file .vi. As I use the drivers you can see some of vi.

    Thanking you,

    Patricia

    @tobid,

    Thank you and sorry long back only I got my error and its job well now... again thanks and sorry that I have not mentioned here...

    Patricia

  • Exe in error for the generation of reports and LV 8.6.1

    I created and installed a labview application in a PC (windows XP) when labview is not installed.  (already included NI_Excel.lvclass)

    I used a generation report (excel) to display the results.

    I am getting following error:

    Error code:-2147352573

    Member not found in NI_Excel.lvclass:

    I use MS office Excel 2007 SP1

    OR LabVIEW Run-Time Engine: 8.6.1.

    Report generation toolkit version: 1.1.3

    Search the website of nor and a 30-day eval copy. For use beyond this period, you will need to purchase a license (unless you have of course)

    compatibility can be found on the following link

    http://digital.NI.com/public.nsf/allkb/C9408B9F08D711E786256F3300701D01

    It may be useful

    TD

  • getBytesLoaded() gets larger than the total size report

    I am trying to program a preloader that uses set of byte values to measure to what extent the loading continued.
    To determine the sizes of individual images, I will summarize the values in the size ratio.
    My problem: when downloading (live as well as in the download w / simulated environment Flash) the getBytesLoaded() func gives me the biggest number that the size (both for _root) ratio and so throw the preloader. How can this be? What Miss me? If I trace() getBytesLoaded() when everything is loaded, the number is about 20% off (top) compared to size ratio.
    Thank you very much!
    Al

    Export the movie with compression disabled... then you will know that the number
    of bytes for each image. Then use these numbers in your script and test
    Once again (like changing the script can change the numbers). Then, when all
    seems to work, turn on compression and it should work perfectly (only
    difference is that all of this will be faster, which is good)
    --
    Jeckyl

  • text and table in excel is not by adding using the generation of reports

    I want the file to write to the attached format. pls help, I m trying for the last 3 days...

    Thanks in advance.

    I did purchase table to write to report.vi. but not able to add it to other excel files.

    Thanks ben,

    your program is working well for version 11. I'm working on version 8. After much trying, I found that, in this document, add table adds in excel unlike in version 11 to give the coordinates (microsoft office settings) to locate the table.

    Thank you for your response.

    dg7318

  • Disable the generation of report when there are no returned by the query

    I would like to write a preliminary report trigger that disables reports generation when my main query in my data model will return no data. If possible, I would like to reuse the same query in the data model from the writing of a motion to double again.

    Thank you all

    Create a view for the main request. In this case, you just have to do it in the front trigger of the report:

    select count(*)
    into my_var
    from my_view
    where ...;
    
    if my_var =  0 then
       return false;
    else
       return true;
    end if;
    

    In where clause you can use the same settings as in your main report query.

  • Possible to automate the generation of reports?

    I don't know if this has been asked, so I'll ask again if she a. reports can be automated and sent on a weekly basis? Thank you.

    David

    I asked the PMs Caron in the past and they said that it is currently not possible. I don't know it is probably an API, simply not documented. I would also like to automate reports that the user interface is quite slow. If all goes well a new version with an exposed API will be available

    =========================================================================

    William Lam

    VMware vExpert 2009,2010

    VMware scripts and resources at: http://www.virtuallyghetto.com/

    Twitter: @lamw

    repository scripts vGhetto

    Introduction to the vMA (tips/tricks)

    Getting started with vSphere SDK for Perl

    VMware Code Central - Scripts/code samples for developers and administrators

    VMware developer community

    If you find this information useful, please give points to "correct" or "useful".

  • Several Documents (invoice) by the generation of reports

    Hello and help

    I have a question during the development with bi publisher.

    I want to generate a report with several bills, as from the notification should be once a month.
    I have a list with bills to print and I will mark some invoices for printing or together.

    So, I have several clients who will get an invoive me.

    How to implement this "as a best practice" in bi publisher?

    How we prevent bi publisher generates the footer, when more than one page has been generated by the customer's Bill in the whole printing process?

    The display of page numbers in the model of footer in the whole printing process?

    How the xml data must be?
    My suggestion would be to generate a table that has all of the information generated by a pl/sql procedure in the database
    but it is necessary?

    Thanks for the suggestions!

    Concerning
    Frank

    Hi frank,.

    You can get different page for a different invoice numbers in a single report using .
    To avoid the footer if your Bill exceeds the first page, you can use . What ever you the code after this will be considered as a footer for this given the transaction on the last page. To the page number, you can use MS word page number. By using for-each@section, you can reset the page numbers for each invoice.
    About the logic of how the XML should be, it depends on your condition.

    I hope this helps you! I am also faced with a similar requirement :)

    Thank you!!

  • adding to a file using the generation of reports

    I try to write in an Excel file in the specified columns and rows which is on my model excel spreadsheet. It does correctly the first time, but she stops and cause an error. Can anyone help to change this code in labview 2009 for me to be able to save the record 30 seconds or what ever the time frame I specify and add to the bottom of the right column and of the line please.

    The logic of 'Elapsed Time' VI instead of your use timing, which will automatically reset after each time specified.

  • need help in the generation of report of programming tool

    Hi all...
    I programmed using report generation tools... I can see the array with all values in excel sheet but I can't see graphic next to it... If anyone can help me in this... I have read reports of tool kit tutorials all parts according to which only changes but usually always able to see the graph...
    I enclose my .vi file
    Patricia

    Hi all

    I found the solution only transposition is vi must be added so that you get correct chart...

    Thank you for the suggestion of rest, I enclose my Vi that works properly.

    Thank you...

    Patricia

  • How to get distinct records by using the ListAgg OBIEE report function?

    Hi all

    I get a correct result as mentioned below. But I don't see duplicates in my result here, in my example, I get duplicate for the name of the employee 'Pat '. So how to get Distinct values by using the LISTAGG function?

    Data set of sample with the Department and its employees

    Service employee

    ----------      ----------

    Marketing Michael

    Pat of marketing

    Pat of marketing

    Pat of marketing

    Purchase of Den

    Purchase of Alexander

    Purchase of Shelli

    Purchase of Sigal

    Guy of purchase

    Purchase of Karen

    Using the ListAgg function, we can convert it to:

    Employees of the Department

    -----------     -------------------------------------

    Marketing of Pat, Pat, Pat, Michael

    Purchase of Sigal, Shelli, Karen, Guy, Den, Alexander

    I tried a lot of things, but I'm not able to understand how exactly this can be achieved, if anyone has any idea or suggestions please do share, thanks in advance.

    After much research, I found the solution & I want to share what he finds very useful, we can create SQL logic in the Advanced tab, as below and after you click Rescan, and then you will get your desired results.

    SELECT saw_0, Evaluate_Aggr T1.dept ("ListAgg(%1,'' & '') intra group (about 1%)") ("as long as VarChar (1000), T1.emp) saw_1 FROM)

    SELECT 'emp_dept '. "the Department dept,

    'emp_dept '. "' employee ' emp

    IN THE "DOMAIN".

    GROUP BY dept, emp

    ) T1 GROUP FROM T1.dept ORDER BY saw_0

    Also note here that we have good anti-aliasing for columns parent (ex: saw_0, saw_1), another by mistake oracle bi server.

  • Set the font size in the generation of explicit report using a model

    Does anyone know how to set the font size using the generation of explicit report with MS Word?  I have trouble getting my 11th column to fit the correct size with the imported data table.  The values end up being off the screen.  Any ideas?

    I suspect that the answer is somewhere within MS Word instead of LabVIEW.  However, I tried it figure out in both and had no luck.  In WORD, I updated all fonts size = 10.  However, the table is imported to the format = 12.  In addition, the table cells are the same size, regardless of the number of columns is imported.

    David

    Just for future visitors to this question are aware, it is a known problem with the generation of report express vi.  There is no solution at this time and the problem will be resolved in future versions of LabVIEW.

  • "The activation server reported that the product key has exceeded its limit of unlocking". Error

    Hello

    I recently changed my motherboard and processor because my old card mother and fried CPU. I had Windows 8 Pro (64-bit) installed earlier, an upgrade to Windows 7 (64-bit). As soon as I started first of all, I got a notification asking me to re - activate my Windows but when I try to activate it with my original key, I get this error: "the activation server reported that the product key has exceeded its limit of unlocking".

    I tried to activate by phone, but instead connect to the automated system, I keep to redirect to voicemail after a few rings. Can someone help me to activate my Windows again? I'm in Karachi, Pakistan.

    The report shows that it is been activated previously, but that the material has changed considerably since the activation - hence the request for reactivation.

    Not too surprising if you traded motherboards. :))

    Telephone activation is definitely the way to go - but it's in the lap of the gods (i.. activation e. operator the MS) as to if they will allow it if the original Win7 installation was an OEM.

    My belief is that they will allow him - of some people hold that they will not :)

Maybe you are looking for