Reporting tree in MS SQL

Hi
In MS SQL I have a table with 2 columns:
Employee          Manager
Scott                Peter
Nancy               Peter
Paul                  Peter
Damien             Scott
German             Scott
Astrid                Scott
Beata                Nancy
Christina           Nancy
Nicole               Nancy
How to get a reporting tree like this in Ms SQL?
Manager            Employee
Peter                  Scott
Peter                  Nancy
Peter                  Paul
Scott                  Damien
Scott                  German
Scott                  Astrid
Nancy                 Beata
Nancy                 Christina
Nancy                 Nicole
Paul                   no _employee
Thanks!
Mecu
gec

You are welcome :-)
Please close the thread my marking the answer (there is a link under the response), and you can vote for people's response that tired to help you as well (using the link in the left of the response).
** If you use UNION instead of UNION ALL then you don't have duplicate values, and you dont need the group by (but the server build the same execution plan in this case).
select t1.Manager, ISNULL(t2.employee,'no _employee') as Employee
from (
select Employee as Manager
from T
union
select Manager
from T
) t1
left join T t2 on t1.Manager = t2.Manager
  Ronen Ariely
 [Personal Site]    [Blog]    [Facebook]

Similar Messages

  • Sorting report columns for PL/SQL report

    I have created a report of type "Pl/Sql function body returning Sql query" in which I am generating the column names within the query. I would now like to make the first three of these columns sortable. But when I click on the "sort" box for the first three columns, all my column names suddenly switch to "Col 1", "Col 2" etc.
    As you can see by the following snippet from the PL/SQL that generates the query, the column names are data driven, so I'm not in a position to declaratively rename each column. As it happens, the first three columns names are fixed, but all the subsequent column names are data driven.
    Suggestions on how to make the first three columns sortable while preserving the generated column names of the remaining columns?
    thanks
    susan weber
    declare
    query varchar2(4000); -- query
    begin
    query := 'select first_name "First Name", last_name "Last Name", encounter_date "Encounter Date" ';
    for c1 in (select distinct attr_src, attr_code, attr_text, sequence_number from finding_vt)
    loop
    query := query || ', (select val_text from finding_vt vt where vt.encounter_id = e.encounter_id and vt.attr_src = ''' || c1.attr_src || ''' and vt.attr_code = ''' || c1.attr_code || ''' and sequence_number = ' || c1.sequence_number || ') "' || substr(c1.attr_text,0,30) || '"';
    END LOOP;
    query := query || ' from patient pat, encounter e where pat.patient_id = e.patient_id';
    return query;
    end;

    This turns out to be related to the choice of "use generic column names" v. "use query specific column names".
    I had chosen "use generic column names" just to get past the initial creation page. I then debugged the query creation sql, but never changed that setting back to "use query specific column names". The fix is to choose "use query specific column names".

  • Running Report in Web Pl/Sql

    Hi All!!
    Which commond should i use to run the Report from Web PL/Sql of
    Designer?
    Thanx
    Pritam

    Hi,
    I am not BOBJ Admin so I don't have on the top of my head that how to do but here two links which might help you.
    [http://blog.mastering-sap-and-businessobjects.com/]
    [http://www.forumtopics.com/busobj/viewtopic.php?p=165424]
    Regards,
    Bashir Awan

  • Report tree issue

    I am trying to change the discription in the report tree that has been built.
    As of now the report tree shows the description which is linked to the reports.
    My issue is that i need to give some other description and not the one which is linked to the reports.
    Can someone tell me how can this be done??

    I am using transaction gd00. I have to change the description. How can this be done??

  • Query Engine report error with Crystal Report 9 And MS SQL SErver 2000

    Hi,
    Currently I m doing a report with Crystal Report 9 and MS SQL as back End.I used a stored procedure to fetch data from DB.The Stored procedure works properly with query analyzer . But when I take report through application
    "Table Not Found" Error is coming.Later I Found that In stored procedure for certain conditions only this error comes.But I cant resolve it.
    Can any One check any pblm with this query
    ELSE IF ISNULL(@intSourceID,0) = 10 Or ISNULL(@intSourceID,0) = 11 Or ISNULL(@intSourceID,0) = 12 Or ISNULL(@intSourceID,0) = 13 Or ISNULL(@intSourceID,0) = 14  
    BEGIN
    IF ISNULL(@intSchemeID,0) <> 0  
    BEGIN
    Select* From table
    END 
    ELSE IF ISNULL(@intSchemeID,0) = 0  
    BEGIN
    Select 
    END 
    END
    When I comment the above codes , report works fine....
    Can any one help me....plz....I m in such a critical situation...

    Hi,
    Currently I m doing a report with Crystal Report 9 and MS SQL as back End.I used a stored procedure to fetch data from DB.The Stored procedure works properly with query analyzer . But when I take report through application
    "Table Not Found" Error is coming.Later I Found that In stored procedure for certain conditions only this error comes.But I cant resolve it.
    Can any One check any pblm with this query
    ELSE IF ISNULL(@intSourceID,0) = 10 Or ISNULL(@intSourceID,0) = 11 Or ISNULL(@intSourceID,0) = 12 Or ISNULL(@intSourceID,0) = 13 Or ISNULL(@intSourceID,0) = 14  
    BEGIN
    IF ISNULL(@intSchemeID,0) <> 0  
    BEGIN
    Select* From table
    END 
    ELSE IF ISNULL(@intSchemeID,0) = 0  
    BEGIN
    Select 
    END 
    END
    When I comment the above codes , report works fine....
    Can any one help me....plz....I m in such a critical situation...
    Refer the above statement highlighted in BOLD. That statement is WRONG. Select what ???? Try any one of the below statement,
    select ''
    --or
    select 0
    --or
    select null
    Regards, RSingh

  • Crystal Report 8.5 with SQL SERVER 2005 problems

    Post Author: AREVA
    CA Forum: Data Connectivity and SQL
    Hi All !We have some problems with Crystal Reports version 8.5 with SQL Server 2005: 1) When we want to generate a report (using data in SQL Server 2005) we have a popup message error : "impossible to loaded pdssql.dll".2) If we want to use SQL Server 2005, which Crystal Reports version we must used ? Is there any restrictions with this connectivity with 8.5 version ?Please, let me known, all informations about SQL Server 2005 and Crystal Report 8.5.Thanks for all !Best regards Anthony

    Hello Kamlesh,
    There is no expectation that the ActiveX viewer (RDC?) from CR8.5 will work in any version of Visual Studio .NET. There is also no expectation that the ActiveX viewer from CR8.5 will work on a machine with a 64 bit operating system.
    You're using VS2008. You should migrate to the bundled edition of CR for VS2008 (v10.5), the ReportDocument object, and the .NET Windows form viewer or Web form viewer.
    Sincerely,
    Dan Kelleher

  • Sharepoint 2013 SSRS Interaction with Sql Server 2012 Reporting Services connecting to Sql Server 2008 R2 database

    Hi
    I'm working on upgrading sharepoint 2010 to sharepoint 2013 with sql server 2008 r2. I've ran into some problems but have been able to get a test farm upgraded. However to run SSRS 2013 it seems Sql Server 2012 Reporting Services are required. Upgrading
    to a full sql server 2012 database isn't an option. I know that sql server 2012 reporting services can use sql server 2008 r2 as a catalog and content database so I was wondering could this be a workaround? Importantly would I need a separate machine/virtual
    machine to host sql server 2012 reporting services? or could it live on the sql server 2008 r2 machine? Any pointers appreciated. Thanks Dan

    Remember that SSRS must be deployed on the SharePoint server. Having said that, yes you can install SSRS 2012 SP1 on a server running SQL 2008 R2. And yes, you can use 2008 R2 as your Database Engine server while SSRS 2012 SP1 runs on the SharePoint server.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Reporting Services for Microsoft SQL Server 2008 R2 (RTM) - 10.50.1617.0

    Hello,
    We are currently running:
    Microsoft SQL Server 2008 R2 (RTM) - 10.50.1617.0 (Intel X86)   Apr 22 2011 11:57:00   Copyright (c) Microsoft Corporation  Standard Edition on Windows NT 5.2 <X86> (Build 3790: Service Pack 2) (Hypervisor)
    We would like to know what is required to configure Reporting Services for Microsoft SQL Server 2008 R2 Standard.  Is their a cost associated?  I need to inform our IT people what is needed.
    Looking forward to your reply, Linda

    Double post:
    http://social.msdn.microsoft.com/Forums/en-US/3e6c5d4e-228e-4a95-b017-4c20ec61cae4/reporting-services-sql-server-express-2008-r2?forum=sqlreportingservices
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Regarding excel download from ALV report tree

    Hi Experts,
    I have a ALV report tree program. In that i need the functionality to download report output in excel file.
    Can any body suggest how can i achieve download to excel functionality in it.
    Any useful suggestion will be appreciated.
    Thanks in advance,
    Akash

    The data for the tree exist in the NODE table in a different format. So, even you download that table, it will not be downloaded in the TREE format. So, the user will not be able to understand the data unlike the case of a ALV GRID.
    Whether it is a TREE / GRID, ultimately its the data of a internal table, that gets downloaded. But in case a TREE, we don't have the data in a straight forward way . i thnk it is not possible . i am not sure too for this .

  • Help required to attach CO-PA reports to Report Tree.

    HI experts,
    Me and my functional are in urgent need of important information. My functional has generate CO-PA reports and now they have asked us to attach those reports to a report tree. My problem is that I have got the transaction SERP which seems useful in attaching the reports the tree. Kindly suggest what is to be done.
    Points will be rewarded.
    Thanks and Regards,
    Saurabh Chhatre

    Hi,
    Check the following links:
    http://www.sap-img.com/abap/tree-type-report-in-abap.htm
    http://www.sap-img.com/ge002.htm
    Regards,
    Bhaskar

  • How to add a report to HR Report tree

    Hello Friends,
                         I need to add a report to HR Report tree.
    Guide me how to do it.
    Cheers
    Senthil

    Use transaction SE43 and SE43N.
    Check this threads
    How to add a report into the tree??
    Adding report/program to Report Tree
    Manoj.

  • Report tree details - SARP/SERP

    Is there a way to see all the reports or transactions attached to a report tree in transaction SARP or SERP?
    -Cheers

    go to SE43n,
    select area menu 'MM01', let suppose to its rel. reports.
    clikc on display.
    now u can able to see reports rel. to Mater. management  now. for tc codes,
    click on addtion inforamtion--> TCode display on /off  on menu bar.

  • Report Tree for PS

    Hi Guys,
    Is there a transaction code for Report tree in PS. Like we have for AP - F.98, assets ART0
    Thanks,
    Satya

    Hi
    Check T code CJE0. Also check T code SARP in that key in report tree PS01.
    Regards

  • Report tree Reporting

    Hi all,
    I would like to create a report similar to the standard report S_ALR_87013611 - Cost Centers: Actual/Plan/Variance (i.e. have a report tree on left and report listing on the right). Is there any sample program I can reference to? Or which classes I can use?
    I know how to create a report with a report tree and an alv grid. But I just have no idea on how to make a report with display like S_ALR_87013611.
    Best regards,
    Steve.

    Hi Steve,
    Pls refer http://www.sapdev.co.uk/reporting/alv/alvtree.htm
    for a sample code .
    Regards,
    Chitra

  • SCCM Reports Will Not Run - SQL Connection Issue

    We have SCCM 2012 R2 CU2 and SQL 2012 SP1 CU6. We used to build our SCCM suites with SQL on the site server and have never had this problem that we now have on a new suite but this time we hosted SQL on its own server (SQ01) separate from the site server.
    SCCM made the SQL server a component server (makes sense) and forced us to put Reporting Services on the SQL server (when trying to put it on the site server it would not find the instance-CM01, as that one has SSRS on it). The site server is ABC01. We've
    already fixed a couple errors in regards to this issue.
    The Reporting Services installed on SQ01 fine. When you go to reports in admin console it loads the 419 default SCCM reports just fine. But none of them will run properly. They open up but a popup appears with this error in the error details popup:
    "An error has occurred during report processing....AbortedException: An error has occurred during report processing...ReportProcessingException: Cannot create a connection to data source AutoGen__(many numbers). System exception..."
    If you go to SQ01, open Reporting Services Config Mgr, connect to instance SC01, click the URL under Report Manager URL, it prompts you for a logon (but should not do so) and you can log in with the service account selected when the Reporting services were
    installed in SCCM Admin Console, drill down into ConfigMgr_ABC, click on the default created data source named {bunch of numbers}, and herein there are two more problems....1) it doesn't save the pwd for the service account, when clicking test connection we
    often have to reenter it, and 2) the ConnectionString has this entry for Source="ABC01.fqdn/CM01" but it will never connect with that. If we change it to just "CM01" and it is currently holding the pwd, it will test connect successfully
    but after just a few minutes it won't because something has reset the connection to "ABC01.fqdn/CM01" and forgotten the pwd. It is apparent that something is overwriting the settings in a way SQL currently doesn't like.
    Also, we have an alias within SQL in this format "SQ01.fqn/CM01" when SQL already has a "CM01" alias. This seems to be a problem too.
    Any input appreciated.
    Ben JohnsonWY

    OK, I'm duly web-embarrassed. Apparently due to some firewall blockage, my Admin Console on my workstation (which is in a different VLAN from these servers), could not save the changed Reporting Services configs to SQL. When we made the changes using the
    Admin Console on ABC01, it all started working.
    Ben JohnsonWY

Maybe you are looking for

  • How to populate optional items in SELECT BOX

    // REGISTRATION.JSP// <%@ page import="java.util.Enumeration" %> <%@ page import="java.util.Vector" %> <%@ page import="java.util.*" %> <%@ page import="java.lang.*" %> <%@ page import="java.sql.*" %> <%@ page import="beans.register2" %> <jsp:useBean

  • Make Flash player window full screen automatically, when it's opening

    Hi, all. It's today I joined Adobe forums so, I don't know much about community guidlines and functionality here. So, pardon me if I do any mistake or something. This is my problem... I'm creating an interface with Adobe Flash Catalyst and I want it

  • Someone help, my phone wont turn on

    i plugged my iphone into speakers today and the screen went fuzzy and it went off. it has not came back on and i have tried holding the power button in and also tried holding both power button and home button in. its an ihpone 4. if anyone has any su

  • Changing doctype in RH7 files

    We need to import a lot of old HTML files (originally produced in XML) into a new project. Our new files have the doctype: <!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN"> This is fine for them but to fix various issues with formatting the

  • How come iPhoto doesn't recognize my iPhone anymore?

    When I first got an iPhone I could sync it to iPhoto and take all the photos off.  Now iPhoto doesn't recognise my iPad or iPhone. Additionally I have overcapacity of 5 GB on my 64 GB iPhone, all because of my 30000 pictures.  Macbook Pro Thank you!