How to create such a view...

Hi friends,
i have this table with following fields and date.
SQL> select * from v_sel_user_region where employee_id = 14210;
COMPANY_ID EMPLOYEE_ID REGION_ID REGION_NAME
1 14210 1 Head Office
1 14210 2 Central Region
1 14210 3 Northern Region
1 14210 4 Southern Region
2 14210 2 Central Region
2 14210 3 Northern Region
2 14210 4 Southern Region
2 14210 6 ESL
Now i want to make create a view that will show distinct regions against a company and user.
like for employee 14210 and whose company is 1 regions are 1,2,3,4
and the same employee in company 2 has regions 2,3,4,5
i want to select distinct regions for company 1 and 2 with employee and company in the view.
How can i create such a view.
Pliz help, Imran

Hi,
well here i am again with another problem.
actually i applied the same code on another table:
SQL> select * from v_sel_user_chapter;
COMPANY_ID REGION_ID EMPLOYEE_ID CHAPTER_ID CHAPTER_NAME
1 1 4009 1 HEAD OFFICE
1 1 5504 1 HEAD OFFICE
1 1 10060 1 HEAD OFFICE
1 1 10120 1 HEAD OFFICE
1 1 14210 1 HEAD OFFICE
1 2 4009 1 HEAD OFFICE
1 2 4009 11 LMA
1 2 4009 14 DEFENCE
1 2 4009 15 GARDEN TOWN
1 2 4009 16 LIBERTY
1 2 4009 17 MULTAN
1 2 4009 18 FAISALABAD
1 2 4009 19 GUJRANWALA
1 2 4009 22 HAFIZABAD
1 2 4009 23 SADIKABAD
now i am useing this code to find distinct chapters for a employee.
select company_id, employee_id, region_id, chapter_id, chapter_name
from (
select company_id, employee_id, region_id, chapter_id, chapter_name,
rank() over (partition by employee_id, region_id, chapter_id order by company_id)
as rang
from v_sel_user_chapter v
) where rang = 1 and employee_id = 14210
but it is still showing some duplicate chapter_id in the result. :(
where i am wrong??
Imran

Similar Messages

  • How to create a query view in sap bw?

    can any one please tell me how to create a query view in sap bw 3.5?

    Hi,
    you can do this by using Bex analyzer and WAD ..
    gop through this link ..
    http://help.sap.com/saphelp_nw70/helpdata/en/0e/1339427f82b26be10000000a155106/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/0d/af12403dbedd5fe10000000a155106/frameset.htm
    hope this helps you ..
    Reagrds,
    shikha

  • How to create a tree view in adobe configurator

    Hi
              How to create a tree view in adobe configurator
    Thanks 

    Please, can you explain what you mean exactly?

  • How to create a help view for a customized error message

    Hi all,
    Can you guide me how to create a help view for a customized error message, we need to put some suggestions in it so that user can can resolve this issue with this guide. ( the short text is too short to describe all situations via TC:SE91)
    Thanks very much!
    Bruce, Wen

    Hi Bruce,
    Could you brief your concerns again.
    Why don't you maintain long text in message class for long description.
    Regards,
    Ranjith N

  • How to create a special view for sharepoint list A and deploy this view to specific user personal view?

    How to create a public view for sharepoint list A and deploy this view to specific user personal view? Is that possible OOTB?

    Views cannot be exported or moved. Can you elaborate your requirement?
    --Cheers

  • How to create a relational view base on an xmltype table which included sev

    Hi,
    I am using oracle 11.2.0.1.0.
    how to create a relational view base on an xmltype table which content several different .xml files?
    Thanks.
    for examle:
    SQL> SELECT OBJECT_VALUE FROM document;
    Edited by: Cow on Jan 6, 2011 7:57 PM

    For example I already have these three xml files inserted into the document xmltype table.
    These xml files have same schemas. I have attached below.
    I want to show all elements/attribute values in xml files to relational view.
    Is this possible to create one big relational view to show everything
    or I have to create three separate relation views then use UNION to put together? Thanks a lot. Cow
    <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
    <document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 http://localhost:8080/home/DEV/xsd/spl.xsd">
    <id root="5ca4e3cb-7298-4948-8cc2-58e71ad32694"/>
    </component>
    </document>
    <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
    <document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 http://localhost:8080/home/DEV/xsd/spl.xsd">
    </component>
    </document>
    Edited by: Cow on Jan 4, 2011 9:51 AM

  • How to create an image viewer

    i need to know how to create an image viewer would appreciate
    help thanks

    you can use loadMovie() to load a jpg image into flash (and
    if you're using flash 8 you can load other image formats into
    flash) and use it to create an image viewer.

  • How to create a materialized view on a subqueried view

    Hi,
    I have a view with subquery. This view is accessed by users frequently. I want to improve its performance by materialiezed view technology. Unfortunately, my view includes a subquery. does anyone have an idea how to create a materialiezed view on a subqueried view?
    Copper

    Oracle 9.2.0.4
    SQL,
    select
    action,
    id,
    id0,
    bl_ticker,
    report_type,
    published_date,
    version,
    decode(rating,'SBUY','Strong Buy',initcap(rating)) rating,
    nvl(fairvalue,(select fairvalue from ard_published_v2_log where id=(select max(id) from ard_published_v2_log where bl_ticker=a.bl_ticker and id<a.id and fairvalue is not null))) fairvalue,
    pricing_date,
    price,
    update_date,
    nid
    from
    select * from ard_published_v2_log
    union select * from nemo_published_history_corr where (action is null or action<>'D')
    minus select * from ard_published_v2_log where action='D'
    minus select * from ard_published_v2_log where id in (select id0 from ard_published_v2_log where id0 is not null)
    minus select * from ard_published_v2_log where id in (select id0 from nemo_published_history_corr where action='D')
    minus select * from ard_published_v2_log where id in (select id0_new from nemo_fillup_id0 where apply=1)
    minus select * from ard_published_v2_log where id>0 and rating='N/A' and price is null-- and nid is null
    ) a
    order by id desc

  • How to create a customized view in SCOM monitoring to view alerts

    Hi All,
    I am trying to create a customized view in SCOM 2012 R2 monitoring for command center team to have the alerts from Server OS, AD, Exchange and few other MPs. I understand that I can use the option "Create by Specific source" and by selecting the
    required sources but I don't want all the alerts from these sources to be listed there but only few alerts which the respective teams want it to be.
    Thanks in advance.
    Regards,
    Srini

    Hi All,
    I am trying to create a customized view in SCOM 2012 R2 monitoring for command center team to have the alerts from Server OS, AD, Exchange and few other MPs. I understand that I can use the option "Create by Specific source" and by selecting the
    required sources but I don't want all the alerts from these sources to be listed there but only few alerts which the respective teams want it to be.
    Thanks in advance.
    Regards,
    Srini
    Hi Srini,
    Based on the above requirement, You want to create a Dashboard view with Specific alerts but not all right ?
    Based on my understanding on your above requirement i created one in my SCOM. Please let me know if this is what you really wanted ?
    For the below you really need to know what are those alerts, ONLY those alerts you want to be displayed in the dashboard.
    Then Go to the Monitoring tab in SCOM and then Right click Active alerts and select New -> Select New Alert view
    When you select new alert view you will need to specify the Resolution state and the Specific alerts you want.
    In the below example i have selected "MSExchange Active sync Alert" as a example. So my goal is here such that only the alerts i have specified from my selection ( "MSExchange Active sync Alert") if it appears in New state will appear
    in this view not all other alerts.
    So for that i just used the below options:
    Resolution state & Alert name
    Resolution state = New
    Alert name = %MSExchange XXXXXXXX%
    Also as of i see there was no option for entering multiple alert names. But i think there is and i am still trying as it accepts some SQL Wild cards. So if any one has an idea what is the wild card what is to be used to mention multiple names in that Name
    view please let me know.
    Gautam.75801

  • [Solved]How to create ADF interface View

    Hi All,
    I have a design problem that I need some help with.
    In one of the pages in our application, we have two drop down boxes one with account type and another with account name (label) and account number (value).
    The account types are Escrow, Credit and Misc (some other types). all three types are in three different tables.
    Now the problem is, in the page when the account type is selected, the second drop down box should be filled with respective account numbers.
    So my question is Can I create an interface view and implement in all three different account type views and use it for second drop down box.
    Thanks in advance for your help.
    Thanks
    Praveen
    Message was edited by:
    bpraveen
    Message was edited by:
    bpraveen

    You might do a VO with a union of the three tables - use a custom SELECT like this:
    SELECT 'Escrow' account_type, account_number, balance, ... FROM escrow_accounts
    UNION
    SELECT 'Credit', account_number, balance, ... FROM credit_accounts
    UNION
    SELECT 'Misc.', account_number, balance, ... FROM misc_accountsUse NULL for any column in a table that does not have that column. I'm not sure if you can use Entity Objects (one EO per table) with such a VO to make the data updatable - it might have to be a read-only VO.
    Or create a database view with this SELECT and base the VO on that view instead of a table. You can even make the view updatable with INSTEAD OF triggers and base an EO on the view.

  • How to create a year view calendar

    Hi All,
    I have a requirement that the report has to display all the months that is January through December as a yearly view calendar.
    Please click here on this below link to see the yearly calendar view style
    [http://www.timeanddate.com/calendar/custom.html?year=2008&country=1&hcl=1&hol=]
    Please if anybody have any input or ideas are welcome.
    Question is is it possible to display this kind yearly calendar style report.
    Thank you,
    Ashok

    This may help you but not sure it's for an entire year....(what you're asking is a big endeavour in CR)....
    Found this by searching the NOTES for "yearly calendar"...
    1198886 - How to create a calendar style report in Crystal Reports XI
    Symptom
    How do you create a calendar style report in Crystal Reports XI?
    Resolution
    NOTE
    This solution involves advanced report design concepts. The user should be familiar with creating formulas, grouping, formatting objects, formatting sections, creating subreports and linking them.
    The first part of this solution involves creating the report and the first group level:
    Before creating the report, create a Microsoft Excel spreadsheet that contains a column called "date" with each day of the year in date format.
    After identifying your data source and tables, create a new report.
    Add the date table from the Excel spreadsheet to the report.
    Insert a group based on the date field. In the dialog This section will be printed for, click For each month.
    Select the Use customized group name based on a formula option and enter this formula (substituting the Excel table and field name for Sheet1_.date if yours is different.):
    Monthname(Month({Sheet1_.date}))
    Insert a new Page Header section.
    Drag the group name field to the Page Header_a section.
    Open the Section Expert, select the Group Header #1 section, and select Suppress.
    In the Section Expert, click the Group Footer #1 section, and select New Page After. In its conditional formula button, enter this formula:
    Not OnLastRecord
    In the main report, create a formula called {@Weeknumber} that contains the following syntax:
    DatePart("ww",{Sheet1_.date})
    In the second section of this solution, you will be creating a second group level:
    Insert a group (Group #2), based on the {@Weeknumber} formula.
    In the Section Expert, select the Group Footer #2 section, and select Suppress.
    Create a formula for each day of the week. Name them {@Sun}, {@Mon}, and so on, using the following syntax:
    If DayOfWeek({Sheet1_.date}) = 1 then Day({sheet1_.date})
    In this formula, the number 1 represents Sunday. For the rest of the six formulas, change the number to 2 for Monday, 3 for Tuesday, 4 for Wednesday, 5 for Thursday, 6 for Friday and 7 for Saturday.
    Add these seven formulas to the Details section. Arrange them in a row, spacing them equally along the page, starting with the formula for Sunday.
    For each of the formulas, insert a Maximum summary function.
    Drag these seven summary fields to the Group Header #2 section.
    Drag the lower boundary of the header down until it is the size that you want the square for the calendar days to be.
    Suppress the Report Header, Details, Page Footer, and Report Footer sections.
    Right-click and format each of the summary fields. In the Number tab click Customize and select Suppress if Zero.
    Draw a box over Page Header_b and extend this down to the bottom of the Group Header #2 section. Then draw vertical lines from the top of the box to the bottom to divide the days, and draw a horizontal line along the top of Group Header #2 to divide the weeks.
    For both the box and the vertical lines, use the Format Editor to select Extend to Bottom of Section when Printing.
    Position the seven summary fields from Group Header #2 where you would like them to be in the day boxes. In Page Header_b, arrange the column labels ('Sun', 'Mon', and so on) so that they are centered above each square.
    The final section will guide you through the Subreport creation part of this solution. Create seven subreports, one for each day of the week. Begin with the subreport for Sunday:
    Create a subreport called "Sun". Select the data source for the data that your calendar data will display.
    Add the data field(s) to the Details section of the subreport that you want to appear in the calendar squares.
    Suppress the remaining sections.
    Place the subreport in the "Sunday" square of the Group Header #2 of the main report. Adjust its size to fit the square.
    In the subreport, create a formula called {@WeekNumber} with the following syntax:
    DatePart("ww",{Appointments.Appointment Date})
    In the Select Expert click show formula and add this syntax:
    Year({Sheet_1.date}) = 2007 and DayOfWeek({Sheet1_.date}) = 1
    In this formula, 2007 is the year of your calendar and 1 is for Sunday.
    Link the subreport to the main report using the {@Weeknumber} formula from each.
    In the main report, right-click the subreport and click Format Subreport.
    In the Common tab, enter this syntax into the conditional formula button next to the Suppress check box:
    Maximum({@Sun},{@Weeknumber}) = 0
    Repeat steps 1 to 8 for the other days of the week, ensuring that you substitute the correct values for the corresponding day of the week.
    Keywords
    template schedule yearly weekly daily appointment appointments business days , 3001298

  • How to create Two Week View of Calendar in Sharepoint 2010.

    There is an option of Week View when i am using Calendar web part, it is showing 1 week view.
    I want to create Two(2) week view of Calendar.
    How can i create Two week view of Calendar.
    Please Help.
    Thanks.

    Hi Priyeshrawat,
    Calendar web part doesn’t provide settings to display two weeks view.
    Based on my understanding, you need to custom a server control to show as the calendar, just like the default calendar control. B y default calendar web part doesn’t contain property to set this.
    Thanks,
    Qiao Wei
    TechNet Community Support

  • How to create a triangle view with a select query?

    I need help to build a select query that will create a triangle view.
    Below is the table I have to query
    *{color:#ff0000}INITIAL TABLE{color}*
    *{color:#008000}AMOUNT | TRANSACTION_DATE | OPEN_DATE | TYPE{color}*
    5 | 30-JAN-09 | 10-JAN-09 | A
    10 | 12-JAN - 09 | 30-NOV-08 | A
    20 | 30 - DEC - 08 | 15-OCT-08 | A
    10 | 30 - DEC - 08 | 8 - OCT - 08 | A
    *{color:#ff0000}THE FINAL TABLE I HAVE TO CREATE:{color}*
    DEV_PERIOD - TO_CHAR(TRUNC(TRANSACTION_DATE,'Q'),'YYYY-Q') AS DEV_PERIOD
    OPEN PERIOD - TO_CHAR(TRUNC(OPEN_DATE,'Q'),'YYYY-Q') AS OPEN_PERIOD
    {color:#008000}*SUM of AMOUNT | DEV_PERIOD | OPEN_PERIOD | TYPE*{color}
    5 | 2009 - 1 | 2009 - 1 | A
    40 | 2009 - 1 | 2008 - 4 | A
    30 | 2008 - 4 | 2008 - 4 | A
    {color:#ff0000}*This is another view of the table (The triangle view)*{color}
    | Dev_Period 2008- 1 | 2008 - 2| 2008 -3 | 2008 - 4 | 2009 -1 |
    Open_Period |
    2008 - 1..................... 0.......... 0............ 0........... 0.......... 0
    2008 - 2 ..................................0............ 0........... 0.......... 0
    2008 - 3................................................. 0........... 0.......... 0
    2008 - 4 ..............................................................30......... 40
    2009 - 1 .............................................................................5
    Any ideas will be appreaciated.
    Thank you!

    I think the first thing you need to do is look up "pivot query" in this newsgroup. And how complicated your query gets to be will depend on your database version (11 natively supports pivot queries). You have a variable number of columns in your result set (depending on how many quarters you have in your data.
    I think once you get the columns sorted out, working out the numbers to put in each column will be relatively easy.
    Jon

  • How to create a dynamic view

    I have 5 tables
    of which one table is transaction table which stores all the trasanctions
    it has near about 30 colms
    from which i need create a dynamic view...
    where user have to passed 5, 6 parameters and get the result .
    how can i create a precompiled view ..

    Why do you want to create a dynamic view.
    It's a bad practice. You had already all column names.
    I think , you can simply create a static view in design time.

  • How to create a tree view to show hierarchy

    Hi all,
    i am new in plugin development.i need help in creating a tree view to show hierarchy.i gone through sdk\paneltreeview example.but not getting clear idea how to create child node.and how to display it..i want to create a simple tree view which displays my custom data as root\child in hierarchy as i want.
    thanks..

    I did this in CS3 a few weeks ago...
    1. subclass NodeIDClass to create your node id class.
    2. subclass ITreeViewHierarchyAdapter to create the adapter
    3. subclass CTreeViewWidgetMgr
    4. in your .fr file, define two "Class"'es based on kTreeViewWidgetBoss (with Interface IID_ITREEVIEWWIDGETMGR and IID_ITREEVIEWHIERARCHYADAPTER) and kTreeNodeWidgetBoss.
    Btw, I put down "persistentlistui" in my note so I guess I looked at that sample instead of the paneltreeeview.
    Good luck.

Maybe you are looking for