Oracle: Analytics: how to sort by using a few column names

I have a request that is the same as the lower.

select organization_name, is_manager, is_vendor, is_engineer from table_org_roles;

The example data:

organization_name|is_manager|is_vendor|is_engineer

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

Org_A   |Yes   |No   |No

Org_B   |No   |Yes   |No

Org_C   |No   |No   |Yes

However I wanted to do a SQL query that is classified by her mounted the role name that is the name of the column. How can I make query that is displayed as below:

Roles(ASC) | Organization

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

is_engineer| Org_C

is_manager | Org_A

is_vendor  | Org_B

Is it possible to make this query using Analytics? Thank you much in advance.

No required Analytics:

SELECT "is_engineer" roles, OrganizationName

OF table_org_roles

WHERE is_engineer = 'Yes '.

UNION ALL

SELECT 'is_manager', OrganizationName

OF table_org_roles

WHERE is_manager = 'Yes '.

UNION ALL

SELECT 'is_vendor', OrganizationName

OF table_org_roles

WHERE is_vendor = 'Yes '.

ORDER BY 1

Tags: Database

Similar Questions

  • How to sort the old radio by file name program files

    I have a series of old time radio shows the file name contains the date in the following format...

    ABCD_40-07-17_ep001_title of the show

    Is there a way to sort these programs... There are many... by the number of date or ep (episode) so that they play in the sequence from the beginning?

    I can manually move the files, but it will take forever.  Any help would be greatly appreciated.

    Hello

    Thanks for posting your question on the Microsoft community.

    Thank you for your query details.

    Also, I understand your concern on the sorting of files.

    Everyone has their own way to organize what is important to them, and you can use Windows 7 to be fair in particular on all of your important files and folders.

    The four basic methods to organize how your files and folders appear in Windows 7 include organization, sorting, grouping and changing your display. Understand the differences between these options will help you customize and combine them at your leisure.

    I suggest you to refer to this article and check if it helps.
    Reference:
    Organize, sort, or group your files
    http://Windows.Microsoft.com/en-us/Windows7/arrange-sort-or-group-your-files

    I hope this information helps.

    Please let us know if you need more help.

    Thank you

  • HOW to: Sort table of VC:HostSystems by name

    Hello

    First of all, I'm new to Javascript.

    I have the following javascript code, and I want to sort my table of parameter Listehotes by host name.

    I tried the array.sort(); function, but as it is not a list of host names and objects. The result is done by host name.

    Does anyone know how to get the desired result?

    / Brian

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

    var allHosts = VcPlugin.getAllHostSystems ();

    HostNameToMatch = 'ESXi ';

    var host = new Array();

    for (var i in allHosts) {}

    If (allHosts [i].name.match (new RegExp (HostNameToMatch, 'i'))) {}

    hosts.push (allHosts [i]);

    }

    }

    Parameter Listehotes = host;

    HostList.sort ();

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

    Hi Brian,.

    use function to extend kind...

    example to the low made by the brain dump, then look in the API in table Explorer, there is also an example

    Kind regards

    Andreas

    var allHosts = VcPlugin.getAllHostSystems ();

    HostNameToMatch = 'ESXi ';

    var host = new Array();

    for (var i in allHosts) {}

    If (allHosts [i].name.match (new RegExp (HostNameToMatch, 'i'))) {}

    hosts.push (allHosts [i]);

    }

    }

    Parameter Listehotes = host;

    HostList.sort (byName);

    byName (a, b) function

    {
         return (a.name <>
    }
  • using line as column names

    All,

    I have two tables like questions_tbl table and response_tbl table I want to use queries the table in question (q1, q2, g3 etc.) as title/names of columns and the corresponding answers in the table response_tbl for this question as column values

    questions_tbl (id, question_code, q1, q2, q3)

    responses_tbl (id, question_code, resp1, resp2, resp3)

    logged in as questions_tbl.question_code = responses_tbl.question_code IE 1-to-many

    example of report,

    What is your favorite car?                 What is xxxxxx?                     What is your best pet?

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

    ford                                             laptop                                     dog

    Chevy                                         cellphone                                dove

    vw                                              ipod                                        dolphin

    How can I write this in sql/plsql to achieve this result?

    Oracle 11g 2

    Thank you.

    create the table questions_tbl as

    Select 1 id, 'T1' question_code, "what is your favorite car?" question of all the double union

    Select 2, 'q2', "what is your favorite device?" of all the double union

    Select 3, "q3", 'what is your favorite animal?' in union double all the

    Select 4, 'T4', "what is your favorite plant?" of all the double union

    Select 5, 'q5', "what is your favorite hamburger?" of the double

    create the table responses_tbl as

    Select 1 id, 'T1' question_code, 'Ford' Union response double all the

    Select 2, 'T1', 'Chevy' from dual union all

    Select 3, 'T1', 'VW' from dual union all

    Select option 4, "T2", "notebook" of the dual union all

    Select 5, 'T2', 'cell phone' from dual union all

    Select 6, 'T2', 'i - pod' from dual union all

    Select 7, "T2", "i - pad' from dual union all

    Select 8, "T2", "toothbrush" dual Union all

    Select 9, "q3", "dog" of all the double union

    10. Select, "q3", "plunged" the dual union all

    Select 11, "q3", "Dolphin" dual union all

    Order 12, "q3", "cat" dual union all

    Select 13, 'q5', 'Ham' from dual union all

    Select 14, 'q5', 'cheese' from dual union all

    Select 15, 'q5', 'fish' of all the double union

    Select 16, 'q5', 'chicken' of the double

    create or replace function report_query (no_of_columns in number) return varchar2 is

    sql_result varchar2 (4000): = q'[select id,

    0 rn,

    Upper (question) text

    of questions_tbl

    Union of all the

    Select q.id,

    ROW_NUMBER() over (partition by order q.question_code by r.id) rn,

    r.Response text

    of questions_tbl q,.

    responses_tbl r

    where q.question_code = r.question_code

    order by id, rn

    ]';

    sql_x varchar2 (4000): = ";

    sql_y varchar2 (4000): = ";

    sql_1 varchar2 (4000): = q'[select row_is,

    RN,

    ]';

    sql_2 varchar2 (4000): = q'[max (c1) c1,

    ]';

    sql_3 varchar2 (4000): = q'[from (select ceil (id /: columns) row_is,)]

    RN,

    ]';

    sql_4 varchar2 (4000): = q'[case when mod(id,:columns) = 1 then c1, end of text,

    ]';

    sql_5 varchar2 (4000): = q'[Correction (select id,

    0 rn,

    Upper (question) text

    of questions_tbl

    Union of all the

    Select q.id,

    ROW_NUMBER() over (partition by order q.question_code by r.id) rn,

    r.Response text

    of questions_tbl q,.

    responses_tbl r

    where q.question_code = r.question_code

    )

    )

    Group of row_is, rn

    order of row_is, rn

    ]';

    Start

    If no_of_columns > 1 then

    because me in 1... no_of_columns

    loop

    sql_x: = sql_x | Replace (sql_2, '1', to_char (i));

    sql_y: = sql_y | Replace (sql_4, '1', to_char (i));

    end loop;

    sql_x: = replace (sql_x, to_char (no_of_columns): ',', to_char (no_of_columns));

    sql_y: = replace (sql_y, to_char (no_of_columns): ',', to_char (no_of_columns));

    sql_y: = replace (sql_y, '=' | to_char (no_of_columns), '= 0');

    sql_result: = replace(sql_1|| sql_x || sql_3 || sql_y || sql_5,':columns',to_char(no_of_columns));)

    end if;

    Return sql_result;

    end;

    Select report_query (3) double T3

    Q3
    Select rn, max c1, c2 max (c2), row_is, max (c3) c3 (c1) from (select ceil(id / 3) row_is, rn, case when mod(id,3) = 1 then text end c1, case when mod(id,3) = 2 then text end c2, case when mod(id,3) = 0 then the text end c3 from (select id, 0 rn) ((, text of upper (question) of questions_tbl union q.id select all the row_number() over (partition by order q.question_code by r.id) rn, text of r.response of q, r responses_tbl questions_tbl where q.question_code = r.question_code)) Group of row_is, sort row_is, rn rn

    Select rn, max c1, c2 max (c2), row_is, max (c3) c3 (c1) from (select ceil(id / 3) row_is, rn, case when mod(id,3) = 1 then text end c1, case when mod(id,3) = 2 then text end c2, case when mod(id,3) = 0 then the text end c3 from (select id, 0 rn) ((, text of upper (question) of questions_tbl union q.id select all the row_number() over (partition by order q.question_code by r.id) rn, text of r.response of q, r responses_tbl questions_tbl where q.question_code = r.question_code)) Group of row_is, sort row_is, rn rn

    ROW_IS RN C1 C2 C3
    1 0 WHAT'S YOUR CAR FAVORITE? WHAT IS YOUR FAVORITE? WHAT IS YOUR ANIMAL FAVORITE?
    1 1 Ford laptop dog
    1 2 Chevy cell phone Dove
    1 3 VW i pod Dolphin
    1 4 - i pad CAT
    1 5 - toothbrush -
    2 0 WHAT IS YOUR FAVORITE? WHAT IS YOUR BURGER FAVORITE? -
    2 1 - Ham -
    2 2 - cheese -
    2 3 - fish -
    2 4 - chicken -

    Select report_query (2) double T2

    Q2
    Select row_is, rn, max (c1) c1, c2 from max (c2) (select ceil(id / 2) row_is, rn, case when mod(id,2) = 1 then text end c1, case when mod(id,2) = 0 then text end c2 from (select id, 0 rn, upper (question) of questions_tbl union q.id text select all, row_number() on rn (partition by order q.question_code by r.id) questions_tbl r.response text q) ((, r responses_tbl where q.question_code = r.question_code)) Group of row_is, sort row_is, rn rn

    Select row_is, rn, max (c1) c1, c2 from max (c2) (select ceil(id / 2) row_is, rn, case when mod(id,2) = 1 then text end c1, case when mod(id,2) = 0 then text end c2 from (select id, 0 rn, upper (question) of questions_tbl union q.id text select all, row_number() on rn (partition by order q.question_code by r.id) questions_tbl r.response text q) ((, r responses_tbl where q.question_code = r.question_code)) Group of row_is, sort row_is, rn rn

    ROW_IS RN C1 C2
    1 0 WHAT'S YOUR CAR FAVORITE? WHAT IS YOUR FAVORITE?
    1 1 Ford laptop
    1 2 Chevy cell phone
    1 3 VW i pod
    1 4 - i pad
    1 5 - toothbrush
    2 0 WHAT IS YOUR ANIMAL FAVORITE? WHAT IS YOUR FAVORITE?
    2 1 dog -
    2 2 Dove -
    2 3 Dolphin -
    2 4 CAT -
    3 0 WHAT IS YOUR BURGER FAVORITE? -
    3 1 Ham -
    3 2 cheese -
    3 3 fish -
    3 4 chicken -

    You said that it is a report

    Concerning

    Etbin

  • How to make reference to a column name in the form report

    Hello
    How can I make reference to a column name in the form report. My problem is that "I have a form report that I have the column name when using click on the column name, it must get to the next page with the corresponding values of the column".

    Here, I realized that when I click on the name of the column (in page 1) it brings me to the next page (page 2). but in the next page (P2) I want to display (display only) the corresponding values of the column (page 1) selected, but the values are not editable and shouldn't be in the text box must be in display area.

    So, how can I write a SQL to display single source field. That is to say, how can I consult report form (page 1) in name column.

    Hello

    If you use the link in the column when you click on the need of the column value, you need to navigate to the next page and all the data accordingly select value here.

    Modify the report form and see the top of the page and click on report attribute.

    So now you have the attributes of the columns is to say what are the columns are available in the reports form.

    Click on change column what you need Ie the column when you click on its passage to the next page this column, for example, as mentioned in the previous post "Empname".

    Check the link column and give perspective of values according to your need and click on apply chages.

    Thank you & best regards
    Srikkanth.M

  • maximum number of characters used in a column

    Hi all
    Suppose I have a table named employee with two fileds (Emp_id and name)
    I need the query to find the maximum number of characters used in the column name until now.

    CNA anyone help me.

    combine the MAX and LENGTH

    as in:

    SQL> select max (length (ename))
      2    from emp
      3  ;
    
    MAX(LENGTH(ENAME))
    ------------------
                     6
    
    SQL> 
    
  • How to post JSON using the Oracle Data Service remains

    I use the regular (not NoSQL or something) oracle database with oracle rest data service. Now I need to post data / put wrote in the body of the request using some json/xml format, how to consume them using the rest data service, searching inside the express application?  important: using pl/sql block

    Also, I am on,

    Data service Oracle rest 3.0

    Oracle Application Express 4.2

    Post edited by: Jacynthe

    OK, I got the answer. At the express request, there is a link called body variable (: body in BLOB). but the BLOB data type. So, we have to convert that in other data, type what we in pl/sql. I've converted data type witch CLOB supports json.

  • How to start to use the Oracle client to access the database?

    People,

    Hello. I just installed Oracle Client (Instant Client) in the directory/home/myOracle/Oracle_Client.
    But I don't know how to start and configure the client to access Oracle database.

    Can all folk tell me how to start to use the Oracle client to access the database?

    user8860348 wrote:
    People,

    Hello. I've successfully used Oracle SQL Developer. But I want to know how to use the Instant Client.

    Can any folk tell me how to use the Client then just install it?

    I guess you're hurting understand the definition of Client instant, there isn't a tool or application or tool GUI as a sql developer or another that you can start using. It's just client installed with the minimum characteristics
    If you want to use the right application tool install sql developer in your instant client or simply running sqlplus

    See you soon

  • How to calculate the use of the memory of the objects in Oracle/Collections

    Hi all
    Our application uses a large hierarchical object to store customer information and dependents. I am looking to display the amount of memory used to contain all the embedded objects and collections when filled with data.

    Please advice!

    Thank you

    PL/SQL collections are stored in the PGA. For example, you can monitor the use of the PGA of the meeting (s) to see how much PGA they use.

    SELECT sid, name, value
      FROM v$statname name
           JOIN v$sesstat using (statistic#)
     WHERE name.name in ('session pga memory', 'session pga memory max' )
    

    This will show, for each session, the current PGA consumed by the session and the high tide of the consumption of the PGA by this session. You can join V$ SESSION and add additional predicates to narrow things down to specific sessions you are interested in.

    Justin

  • My ipod video 5th generation won't play of smart playlists in order with 12.4 itunes, itunes can not remember how to sort things either. When you going to solve the problem?

    My iPod video 5th generation won't play of smart playlists in order with 12.4 iTunes, iTunes can not remember how to sort things either.

    When you going to solve the problem?

    Can I do to solve this problem?

    Use the view of songs to set the order you want. Right-click on the name of the playlist in the left sidebar, and then select copy to Play Order in the context menu. Sort the list on the left most column of numbers, or use view > sort by > order of Playlist. Device synchronization.

    TT2

  • How can I get only a few things that start on my computer instead of all sorts of things at once

    How can I get only a few things that start on my computer instead of all sorts of things at once

    Hello

    You can use these to control which startup programs. Many others who settle start-up are not
    really need to be there. As Acrobat Reader (Adobe), Agent of WinAmp and many others who
    load chunks of themselves to start more quickly (not a problem on the machines of today ' hui) and to make sure that they
    can control the files they support (to be sure that you continue to use only). Those who are not common
    examples and not meant as a slam on these programs very well.

    How to troubleshoot a problem by performing a clean boot in Windows Vista
    http://support.Microsoft.com/kb/929135
    How to check and change Vista startup programs
    http://www.Vistax64.com/tutorials/79612-startup-programs-enable-disable.html

    Autoruns - free - see what programs are configured so that it starts automatically when
    your system boots and you connect. Autoruns also shows you the complete list of the registry
    and where applications can configure Auto-start for the files settings.
    http://TechNet.Microsoft.com/en-us/sysinternals/bb963902.aspx

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

    Performance and maintenance tips
    http://social.answers.Microsoft.com/forums/en-us/w7performance/thread/19e5d6c3-BF07-49ac-a2fa-6718c988f125

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • I'm on the 4.1.1.00.23 Apex vesion. I've created a classic report and I am trying to sort. Here's how I'm trying to sort by column name. I have TotPGPV with sorting sequence 1 desc and NewTOTPGPV with sorting sequence 2 desc. I have Count1, Count5 with t

    I'm on version 4.1.1.00.23 of the APEX. I've created a classic report and I am trying to sort. Here's how I'm trying to sort by column name. I have TotPGPV with sorting sequence 1 desc and NewTOTPGPV with sorting sequence 2 desc. I have Count1, Count5 with the sort column. What I'm asking is when the report is run can column sorting to default Count1 and Count5 descending instead of the ascendant. I don't see anywhere to set the default value for the sort column.

    Hi - on the report of the page attributes - that you show in your attached screenshot - you can select the columns to sort on the sort sequence as well as the direction of the sort, i.e. for a given column, you can choose to allow sorting on this column, what position this column must be in the sort sequence and whether to sort Ascending or descending by default (i.e. '1' means sort this column first and bottom-up and "1 desc") sort this column first and downhill). Don't forget that once you click on one of the headings of column during execution, it changes your sort settings and these settings are stored in your preferences, that is, they are used again the next time you log in your application and rerun the report.

    Kind regards
    Marc

  • How Oracle called the hidden for the function-based index columns?


    I came across an interesting problem today.  Statistics object for a schema that have been created on the basis of data X have been imported into a 'identical' to the database schema Y.

    The problem is that, on the basis of data X a group of hidden columns associated with index based service (FBIs) were named SYS_NC00182$ to SYS_NC00191$ and on the basis of data Y the same hidden columns were named SYS_NC00183$ to SYS_NC00192$!  The consequence was that statistical column for an FBI data base X have been used for a totally different FBI on the database Y.

    Now, of course, if this was g 11 or 12 c I could just create virtual columns and those of the index.  In this way the names of the columns would be compatible on databases.  However, it is a 10g database, and I do not have this option.

    I am curious to understand how Oracle generates these hidden column names.  I'm also curious if, in 10g, there is a way to identify the name of a column hidden for an FBI that doesn't involve a statement explain plan running on a query that uses all the expressions of the FBI for the table.

    The names of $ SYS_NCnnnnn are based on the internal column id - what is loosely based on the order of creation of the FBI. If you delete a column the column internal ids (after this column), which means the names for the SYS_NCnnnnn$ the change.  An opportunity to explain your results is that a (real) column on the X data table fell, but the column still exists on the database Y.

    If you want to get the link between the current internal name and expression, then you can start with dba_ind_expressions - and create a customized version of the view - e.g @.

    Select c.intcol #, c.name, io.name, idx.name, bo.name, base.name, c.default$, ic.pos #.

    of sys.col$ c, sys.obj$ idx, basis of sys.obj$, sys.icol$ ic.

    sys. User$ io, sys.user$ bo, sys.ind$ I

    where bitand(ic.spare1,1) = 1 / * expression * /.

    and (bitand (students, 1024) = 0) / * not bmji * /.

    and ic.bo # c.obj = #.

    and ic.intcol # c.intcol = #.

    and ic.bo # base.obj = #.

    and io.user # idx.owner = #.

    and bo.user # base.owner = #.

    and ic.obj # idx.obj = #.

    and idx.obj # i.obj = #.

    and however # (1, 2, 3, 4, 6, 7, 9)

    /

    The first two columns in the select ones that I added to the initial view definition.

    Concerning

    Jonathan Lewis

  • How to debug OSM using breakpoints

    Is there documentation that tells one how to debug by using breakpoints in the sub-process OSM?  I also noticed that in some of the XQuery queries there are references to the oxygen.  Is there documentation on how to use it?  I took all three classes training OSM and this was not described in any of them.

    Hello

    You can actually see "cartridge Guide for Oracle Application Integration Architecture. In that specific reference to sections

    (1) OracleComms_OSM_O2A_ControlMap

    (2) setting breakpoints of cartridge

    For example: when the order is sent if you preface [AIATest.2.0] to the Siebel 1-487639 order number then Decree OSM fulfills tasks SyncCustomer and expected before InitiateBillingSITask is called.

    Siebel order number: 1-487639 [AIATest.2.0]

    Thank you

    Native Jacques

  • How much memory to use an instance of SOA?

    Hello!

    Is it possible to know how much memory is using an instance in Oracle SOA Working? Or at least, an application on a WebLogic Server?

    Greetings, Peter.

    Peter,

    You can monitor the memory usage of all JVM running the application server, but there is no way to understand that the amount of memory has been attributed to a particular application / instance running on this server.

    Kind regards
    Anuj

Maybe you are looking for