Help needed in - appending query string

Hai All,
Its very Urgent for me.Can anyone pls tell me how can I do the following.
I want the query String of first page to be appended to the next following pages also.

u want first page URL to second page or page data?

Similar Messages

  • Help needed for writing query

    help needed for writing query
    i have the following tables(with data) as mentioned below
    FK*-foregin key (SUBJECTS)
    FK**-foregin key (COMBINATION)
    1)SUBJECTS(table name)     
    SUB_ID(NUMBER) SUB_CODE(VARCHAR2) SUB_NAME (VARCHAR2)
    2           02           Computer Science
    3           03           Physics
    4           04           Chemistry
    5           05           Mathematics
    7           07           Commerce
    8           08           Computer Applications
    9           09           Biology
    2)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2) SUB_ID1(NUMBER(FK*)) SUB_ID2(NUMBER(FK*)) SUB_ID3(NUMBER(FK*)) SUBJ_ID4(NUMBER(FK*))
    383           S1      9           4           2           3
    384           S2      4           2           5           3
    ---------I actually designed the ABOVE table also like this
    3) a)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2)
    383           S1
    384           S2
    b)COMBINATION_DET
    COMBDET_ID(NUMBER) COMB_ID(FK**) SUB_ID(FK*)
    1               383          9
    2               383          4
    3               383          2
    4               383          3
    5               384          4
    6               384          2          
    7               384          5
    8               384          3
    Business rule: a combination consists of a maximum of 4 subjects (must contain)
    and the user is less relevant to a COMB_NAME(name of combinations) but user need
    the subjects contained in combinations
    i need the following output
    COMB_ID COMB_NAME SUBJECT1 SUBJECT2      SUBJECT3      SUBJECT4
    383     S1     Biology Chemistry      Computer Science Physics
    384     S2     Chemistry Computer Science Mathematics Physics
    or even this is enough(what i actually needed)
    COMB_ID     subjects
    383           Biology,Chemistry,Computer Science,Physics
    384           Chemistry,Computer Science,Mathematics,Physics
    you can use any of the COMBINATION table(either (2) or (3))
    and i want to know
    1)which design is good in this case
    (i think SUB_ID1,SUB_ID2,SUB_ID3,SUB_ID4 is not a
    good method to link with same table but if 4 subjects only(and must) comes
    detail table is not neccessary )
    now i am achieving the result by program-coding in C# after getting the rows from oracle
    i am using oracle 9i (also ODP.NET)
    i want to know how can i get the result in the stored procedure itsef.
    2)how it could be designed in any other way.
    any help/suggestion is welcome
    thanks for your time --Pradeesh

    Well I forgot the table-alias, here now with:
    SELECT C.COMB_ID
    , C.COMB_NAME
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID1) AS SUBJECT_NAME1
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID2) AS SUBJECT_NAME2
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID3) AS SUBJECT_NAME3
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID4) AS SUBJECT_NAME4
    FROM COMBINATION C;
    As you need exactly 4 subjects, the columns-solution is just fine I would say.

  • I need to append a string to another string

    I'm working with some inherited code, I'm a Colf Fusion
    novice myself, and I'm trying to make this order form display the
    correct data. The problem is a lot of data in the database is
    missing. Description in the QStockDB query can contain a lot of
    stuff. For our full color work the text "4/0", "4/BLACK", and "4/4"
    are consistent so I'm changing the newitem (I know, not very
    descriptive but it's not my code) to CMYK Printing.
    <cfif #QStockDB.description# contains "4/0"><cfset
    newitem = "CMYK Printing"></cfif>
    <cfif #QStockDB.description# contains
    "4/4/BLACK"><cfset newitem = "CMYK Printing"></cfif>
    <cfif #QStockDB.description# contains "4/4"><cfset
    newitem = "CMYK Printing"></cfif>
    I want to then go back through description and compare it
    more to add more description. For instance with this:
    <cfif #QStockDB.description# contains "12 pt"><cfset
    newitem = newitem + " - BC"></cfif>
    I know that the job is a business card. So I want to append
    the newitem variable with " - BC". Likewise:
    <cfif #QStockDB.description# contains
    "catalog"><cfset newitem = newitem + " - Catalog
    Sheets"></cfif>
    displays CMYK Printing - Catalog Sheets. Or, it should... or,
    more precisely, I want it to. :)
    How do I append a string to another string?

    + is the addiion operator and works with numbers. Because
    your string is a ...well, string... you need to use an ampersand.
    Thus, instead of:
    <cfif #QStockDB.description# contains
    "catalog"><cfset newitem = newitem + " - Catalog
    Sheets"></cfif>
    Use...
    <cfif #QStockDB.description# contains
    "catalog"><cfset newitem = newitem & " - Catalog
    Sheets"></cfif>
    <cfoutput>#newitem#</cfoutput>
    At least I think that will work - haven't tested it
    though.

  • Expert help needed with tricky query

    I have a query database with a real simple schema but a tricky requirement: i need to display records with a simple select but then filter the result based on the authority/access level of the user making the query.
    The source data is held in a table with just the following columns:
    SRCTABLE:
    subject_ID
    date
    data_ID
    data_item
    All column types are text strings and the first 3 are a composite key. There are 10s of millions of records in the table.
    The access authorization is held in another table with the following columns:
    ACCTABLE:
    data_ID
    access1
    access2
    accessn
    The ellipsis means there are as many (boolean type) access1...n columns as there are distinct access levels to the source data.
    The table contains one row for each distinct data_ID appearing in the source table. On each row the TRUE values in the access1...n columns indicate authorization to see the data item and the filter should leave that row in the result set.
    The question then is how to write the query statement? It is assumed that the access id (i.e. the relevant column) is known when the query is made.
    Something like
    SELECT data_item FROM SRCTABLE
    WHERE subject_ID="xxx" AND date = "1/1/2000";
    would do it except for the need to filter each row based on the access authorization of the user.
    Any help would be appreciated.

    Thanks everybody for responding.
    APC has a good point about really protecting every single item type separately. Unfortunately this is precisely the case. The security in this case is not oriented to increasing security in a levels oriented way. Rather each kind of item is protected by a need to know type security related to that particular item. Users are classified by their need to know a combination of the item types and those combinations are not in any sense consistent (and there will be new classes over time). This way access control necessarily becomes a matrix of item types vs access classes.
    Fortunately this particular database does not exist yet so i am free to solve the problem in any way that fulfills the requirement. This is just the suggested form. I am not entirely happy with it hence the question on this forum in the first place.
    So, i appreciate it should you have any further suggestions for optimal solution to handle the requirements. Again, those are:
    1. A query that returns the data_items for a given ID and date (this is dead simple)
    2. A filter (preferably in the query) that filters out those data_items the current user (his/her access class is known) is not authorized to see.
    3. The plan calls for a table listing every possible item type with a column for each access class, enumerating the items allowed for that class. Any other solution to this issue would be acceptable provided it is capable to independently validate any single item type against any access class.
    I hope this makes sense.

  • Help needed for SQL query

    hello ,
    I am a beginner in terms of writing sql queries. I hope some body can help me out.
    I have two tables
    mysql> desc user_group_t;
    ---------------------------------------------------+
    | Field | Type | Null | Key | Default | Extra |
    ---------------------------------------------------+
    | userAccountId | char(8) | | PRI | | |
    | groupId | char(8) | | PRI | | |
    ---------------------------------------------------+
    2 rows in set (0.00 sec)
    mysql> desc group_t;
    ---------------------------------------------------+
    | Field | Type | Null | Key | Default | Extra |
    ---------------------------------------------------+
    | id | char(8) | | PRI | | |
    | name | char(50) | YES | | NULL | |
    | email | char(100) | YES | | NULL | |
    | description | char(254) | YES | | NULL | |
    | parentId | char(8) | YES | | NULL | |
    | creatorId | char(8) | YES | | NULL | |
    | createDate | char(20) | YES | | NULL | |
    | updateDate | char(20) | YES | | NULL | |
    | updatorId | char(8) | YES | | NULL | |
    ---------------------------------------------------+
    9 rows in set (0.00 sec)
    what I want is list of all groups with id,name and #of members(which is the # of rows in the user_group_t for any given id). Importantly I need the groups with 0 members also to be listed. In short my output should contain exactly the same number of rows as in group_t table with an additional column indicating # of members for that group.
    Any help would be greatly appreciated.
    Thanks in Advance.
    -Vasanth

    Thanks Donald,
    Actually I figured it out, with the following query:
    select id,name,sum(if(groupid is not null,1,0)) as members from group_t left join user_group_t on id=groupid group by id;
    I tried your solution, but mysql says there is an error at '+' . Anyway I modified your solution to the one below and it worked.
    select a.id, a.name, count(b.groupid) from group_t a left join user_group_t b on a.id=b.groupid group by a.id, a.name;
    I tried that before but then I used Count(*) instead of count on groupid. Your solution is elagant and I will go with yours.
    Thanks again.
    Vasanth

  • Urgent help needed on 1 query

    Hello All,
    I have just started working in PL/SQL,
    I need some help on 1 urgent issue.
    i have a table lets say which has structure and values like below:
    ID Data Key Data Value
    1 Firstname X
    2 Lastname Y
    3 Middlename Z
    but my query shd return me data having firstname ,middlenale and last name as column names and lvalues like lsited below:
    Firstname Middlename Lastname
    X Y Z
    Please help and i really appreciate for your time and help!!!!!!!!!!
    Thanks and Regards

    Urgent? I don't think so.
    However, as others have mentioned, what groups the items together so that the relationship is known between them?
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as id, 'Firstname' as data_key, 'Fred' as data_val from dual union all
      2             select 2, 'Surname', 'Bloggs' from dual union all
      3             select 3, 'Middlename', 'J' from dual union all
      4             select 4, 'Firstname', 'John' from dual union all
      5             select 5, 'Surname', 'Doe' from dual union all
      6             select 6, 'Middlename', 'D' from dual)
      7  --
      8  select id-decode(data_key,'Surname',1,'Middlename',2,0) as id
      9        ,max(decode(data_key,'Firstname',data_val)) as Firstname
    10        ,max(decode(data_key,'Middlename',data_val)) as Middlename
    11        ,max(decode(data_key,'Surname',data_val)) as Surname
    12  from t
    13* group by id-decode(data_key,'Surname',1,'Middlename',2,0)
    SQL> /
            ID FIRSTN MIDDLE SURNAM
             1 Fred   J      Bloggs
             4 John   D      Doe
    SQL>This example assumes that a Firstname, Surname and Middlename appear in that order with sequential ID's, such that the ID for Surname is always 1 more than the ID for it's associated Forename and the ID for Middlename is always 2 more than the associated Forename.

  • Help needed in select query

    Hi,
    I need to select the max time for the transaction using the below query. I’m able to get the o/p. Here the problem is I need to fetch the corrletorid (primary key) as well. if try to get that I’m getting the o/p like case2.
    I want the o/p to be like case 1 with the corrleator id . plz help me to get the o/p.
    Case 1: select b.TransactionName, max(to_char(b.duration, 'mm/dd/yyyy hh24:mi:ss.ff')) as average from trandetails a,subtrandetails b where a.CORRELATORID=b.PCORRELATORID and b.PCORRELATORID='11' group by b.transactionname
    TRANSACTIONNAME MAXTIME
    FINT3 12/10/2007 19:53:09.042000
    FINT 12/10/2007 19:31:07.042000
    FINT2 12/10/2007 19:31:07.042000
    SQL> /
    Case 2: select b.TransactionName,b.correlatorid, max(to_char(b.duration, 'mm/dd/yyyy hh24:mi:ss.ff')) as average from trandetails a,subtrandetails b where a.CORRELATORID=b.PCORRELATORID and b.PCORRELATORID='11' group by b.transactionname,b.correlatorid
    SQL> /
    TRANSACTIONNAME CORRELATORID AVERAGE
    FINT2 102 12/10/2007 19:31:07.042000
    FINT3 108 12/10/2007 19:53:09.042000
    FINT3 103 12/10/2007 19:31:07.042000
    FINT 101 12/10/2007 19:31:07.042000
    in the above output i should have only record(max time) for FINT3.
    Thank

    Sharma,
    Please find the below sample data(insert stmt and create table):
    ======================================
    create table trandetails(
    correlatorid varchar2(20) CONSTRAINT correlatorid_FKey REFERENCES Subtrandetails(correlatorid),
    username varchar2(25) NOT NULL,
    applicationname varchar2(25) NOT NULL,CONSTRAINT composite1_pkey1 PRIMARY KEY(correlatorid ,applicationname));
    create table Subtrandetails(
    correlatorid varchar2(20) PRIMARY KEY,
    PCORRELATORID      varchar2(20),
    TransactionName varchar2(25) NOT NULL,
    Machinename varchar2(15) NOT NULL,
    STARTDATE timestamp NOT NULL,
    ENDDATE timestamp NOT NULL,
    SourceName varchar2(25),
    FunctionName varchar2(25),
    LOC number(5),
    CONTEXTPROPERTY1 varchar2(25),
    CONTEXTPROPERTY2 varchar2(25),
    CONTEXTPROPERTY3 varchar2(25),
    TransactionStatus varchar2(25) NOT NULL CONSTRAINT Transaction1_Status_chk Check (TransactionStatus in ('Success', 'Failure', 'Abort')));
    INSERT INTO trandetails VALUES ('11','FINAPP','ANUAPP1');
    INSERT INTO trandetails VALUES ('13','FINTEST','ANUAPP2');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('10','1','ARM','blrkec95931d','10-DEC-07 03.24.07.042000 PM','10-DEC-07 03.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('11','1','ARM1','blrkec95931d','10-DEC-07 04.24.07.042000 PM','10-DEC-07 04.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('12','1','ARM2','blrkec95931d','10-DEC-07 05.24.07.042000 PM','10-DEC-07 05.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('13','1','ARM3','blrkec95931d','10-DEC-07 06.24.07.042000 PM','10-DEC-07 06.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('14','1','ARM4','blrkec95931d','10-DEC-07 07.24.07.042000 PM','10-DEC-07 07.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('101','11','FINT','blrkec95931d','10-DEC-07 07.24.07.042000 PM','10-DEC-07 07.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('102','11','FINT2','blrkec95931d','10-DEC-07 07.24.07.042000 PM','10-DEC-07 07.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('103','11','FINT3','blrkec95931d','10-DEC-07 07.24.07.042000 PM','10-DEC-07 07.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('104','13','SAP1','blrkec95931d','10-DEC-07 07.24.07.042000 PM','10-DEC-07 07.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('105','13','SAP2','blrkec95931d','10-DEC-07 07.24.07.042000 PM','10-DEC-07 07.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('106','13','SAP3','blrkec95931d','10-DEC-07 07.24.07.042000 PM','10-DEC-07 07.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('107','13','SAP2','blrkec95931d','10-DEC-07 07.2.10.042350 PM','10-DEC-07 07.50.10.042050 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('108','11',' FINT3 ','blrkec95931d','10-DEC-07 07.16.07.042000 PM','10-DEC-07 07.53.09.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('109','108','FINT3','blrkec95931d','10-DEC-07 07.20.07.042000 PM','10-DEC-07 07.59.09.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('110','108','FINT3','blrkec95931d','10-DEC-07 07.18.07.042000 PM','10-DEC-07 07.57.09.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('111','108','FINT4','blrkec95931d','10-DEC-07 07.18.07.042000 PM','10-DEC-07 07.57.09.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('112','108','FINT5','blrkec95931d','10-DEC-07 07.18.07.042000 PM','10-DEC-07 07.57.09.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('113','108','FINT6','blrkec95931d','10-DEC-07 07.18.07.042000 PM','10-DEC-07 07.57.09.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('114','108','FINT7','blrkec95931d','10-DEC-07 07.18.07.042000 PM','10-DEC-07 07.57.09.042000 PM','Success');
    ======================================
    Thanks.

  • Help needed in a Query

    I have a table TAB that has two colums. COL1 and COL2. Both are composite Primary key.
    The data is as
    COL1 COL2
    1 C
    2 C
    3 C
    4 G
    5 G
    1 G
    3 G
    6 G
    7 G
    I need to find out those COL1 values whose COL2 values are C and G. Ex
    COL1 COL2
    1 C
    3 C
    1 G
    3 G
    So i need the following op
    COL1
    1
    3
    Please help me to solve this query.
    Regards.
    Message was edited by:
    SID

    and what have you tried ????
    SQL> With t As
      2    (
      3    Select 1 c1, 'C' c2 From DUAL Union All
      4    Select 2,     'C'   From DUAL Union All
      5    Select 3,     'C'   From DUAL Union All
      6    Select 4,     'G'   From DUAL Union All
      7    Select 5,     'G'   From DUAL Union All
      8    Select 1,     'G'   From DUAL Union All
      9    Select 3,     'G'   From DUAL Union All
    10    Select 6,     'G'   From DUAL Union All
    11    Select 7,     'G'   From DUAL
    12    )
    13    Select t.c1, t.c2
    14    From
    15    t,
    16    (
    17    Select c1, c2
    18    From t
    19    Where c2 = 'C'
    20    ) c,
    21    (Select c1, c2
    22     From t
    23     Where c2 = 'G'
    24     ) g
    25  Where t.c1 = c.c1
    26  And   t.c1 = g.c1
    27  --And   c.c2 = g.c2;
            C1 C2
             1 C
             1 G
             3 C
             3 G
    SQL>
    /*using analytical functons*/
    SQL>
    SQL> With t As
      2    (
      3    Select 1 c1, 'C' c2 From DUAL Union All
      4    Select 2,     'C'   From DUAL Union All
      5    Select 3,     'C'   From DUAL Union All
      6    Select 4,     'G'   From DUAL Union All
      7    Select 5,     'G'   From DUAL Union All
      8    Select 1,     'G'   From DUAL Union All
      9    Select 3,     'G'   From DUAL Union All
    10    Select 6,     'G'   From DUAL Union All
    11    Select 7,     'G'   From DUAL
    12    )
    13   select c1, c2
    14         from ( select c1,c2, case when c2 = 'C' then count(decode(c2,'G',1)) over (partition by c1)
    15                                    when c2 = 'G' then count(decode(c2,'C',1)) over (partition by c1)
    16                               else 0 end count                           
    18                from t
    19            )
    20      where Count != 0
    21  /
            C1 C2
             1 C
             1 G
             3 C
             3 GMessage was edited by:
    Nicloei W

  • URL-Rewriting or append query string in URL

    Hi
    I have one other quetion related to my project I am working and need to finish tonight.
    I read one table in first JSP and want to send one column, eventname to the other JSP. Can I use URL-rewriting. I need to keep the event name thruoghout too.
    Is this syntax correct..
    Please help me !!!

    Syntax is:
    <a href="ListEvents.jsp?event=eventname">Click me</a>In the JSP, there are two things you may need to do when generating the link.
    1. Encode the URL - this is needed if any arguments (in this case "eventname") might include spaces or special characters.
    2. Apply URL rewriting info if this may be needed. This will add "&JSESSIONID=xxxxx" if required.
    <%
    String link = "ListEvents.jsp?event=" + getEventName();  // or whatever gets the event name
    link = java.util.URLEncode.encode(s,"UTF-8");    // encode the event name data
    link = response.encodeURL(link);                      // add the session id if URL rewriting in use
    %>
    <a href="<%=link%>">Click Me</a>The event name is retrieved using request.getParameter("event")

  • Help need in hierarchy query

    Hi,
    I need to display the parent child nodes in the hierarchical manner and i need to list the user under their hier name in the same hierarchical structure. table structures are all as follows.
    user table:
    * userid name*
    100 john
    101 shaddy
    102 sandy
    103 Kalinich
    104 king
    105 Teresa
    106 Clinia
    user hier table :
    userid  hier name
    100 node1
    101 node2
    102 node1
    103 node2
    104 parent
    105 node4
    106 node
    hier table:
    id hier name parent_id
    1 parent
    2 node 1
    3 node1 2
    4 node2 2
    5 node3 1
    6 node4 5
    7 node5 5
    o/p :
    104 king
    106 clinia
    100 john
    102 sandy
    103 Kalinich
    101 shaddy
    105 terresa
    even we dont have entry in user hier and user table for node3 we need to display them child users under the "parent" hier name and need to ignore the child nodes which dont have users under them i.e) need to ignore node5 in the output. below is the query which I have tried.
    SELECT NAME,u.name
    FROM user_hier n,hier u,user a
    WHERE a.user_id (+) = u.user_id
    AND u.name (+) = n.name
    START WITH n.name = 'parent'
    CONNECT BY PRIOR n.node_id= n.parent_node_id;
    Help me on this.
    Thanks in advance
    Edited by: Vi on Apr 30, 2012 6:10 AM

    No you haven't. Either post create table statements or set up your data with a WITH clause, something like the following example:
    with USER_TABLE as (
      select 100 userid, 'john' name from dual union all
      select 101 userid, 'shaddy' name from dual union all
      select 102 userid, 'sandy' name from dual union all
      select 103 userid, 'Kalinich' name from dual union all
      select 104 userid, 'king' name from dual union all
      select 105 userid, 'Teresa' name from dual union all
      select 106 userid, 'Clinia' name from dual
    select * from USER_TABLE
        USERID NAME
           100 john
           101 shaddy
           102 sandy
           103 Kalinich
           104 king
           105 Teresa
           106 Clinia
    7 rows selected.

  • Help needed in building query

    Tab1
    Parent       Child       sa l
    P1     A1       4000
    A1     A       1000
    A1     B       4000
    A     X       1000
    A     Y         2000
    B     X1        1000           
    B     X2       3000I need to build a query that will retrieve the value for each child as the sum of the salaries of all its child in a single query.
    That is
    For Sal P1 = Sal A1 + all child of A1 and its child
         For A1 = Sal A1 + all child of A1 and its child ( A+B+X+Y+X1+X2)
    Like it should sho all the records with the count .. please help

    This is not so simple since it is not really clear in your data set whether the sal belongs to the parent or to the child. I assume it's the salary of the child, in which case the salary of P1 is missing. The best option is to fix the data model and have two tables: one containing the element and sal, and another table containing just the relationships. To fix this issue I introduced a dummy record for P1 and salary 0.
    SQL> with t2 as
      2  ( select connect_by_root(child) cbr
      3         , sal
      4      from (select * from t union all select null,'P1',0 from dual)
      5   connect by parent = prior child
      6  )
      7  select cbr child
      8       , sum(sal)
      9    from t2
    10   group by cbr
    11  /
    CHILD    SUM(SAL)
    X1           1000
    A1          16000
    X2           3000
    P1          16000
    Y            2000
    X            1000
    A            4000
    B            8000
    8 rows selected.Regards,
    Rob.

  • Help needed in writing query

    Hi,
    Could anyone help me in writing below query without syntax errors.
    I tried but no luck
    select xmlelement("g", XMLATTRIBUTES(g.contentgroup_id as "id",g.groupname as "label",
    (select xmlagg(xmlelement ("c",XMLATTRIBUTES(c.title as "title",c.content_id as "id")))) as "A"))
    as "A" from
    (SELECT g.contentgroup_id AS id, g.groupname AS label, c.title AS label, c.content_id AS id
    FROM content_ec c FULL OUTER JOIN contentgroup_ec g ON c.group_id = g.contentgroup_id
    oRDER BY g.groupname ,c.title ASC );
    Any help really appreciated.
    Thanks

    Few tips to get your question answered here
    1. Give your database version. Some thing that does not work in one version works fine in the next. And 8i,9i or 10g is not version. best way to give the version is to query your v$version table like this.
    SQL> select * from v$version where rownum = 1
      2  /
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod2. You should understand we don't have what you have, meaning you should provide your data structure and some sample data for us to help.
    3. "I got an error"... "Its not working"... and the list goes on. Sentences like this does not help. If you got a error past the entire error. If stuff does not work, tell us the details.
    4. Just don't throw some output and say i want it. Please explain to every one how you derive it.
    5. And the most important thing. Use \...\ tag to format. Please.. Please.. Please.. use it. It helps every one a lot. When you use it your SQL looks some thing like this.
    SELECT xmlelement("g", XMLATTRIBUTES(g.contentgroup_id as "id",g.groupname as "label",
         (select xmlagg(xmlelement ("c",XMLATTRIBUTES(c.title as "title",c.content_id as "id")))) as "A")) as "A"
       FROM (SELECT g.contentgroup_id AS id,
                 g.groupname AS label,
                 c.title AS label,
                 c.content_id AS id
            FROM content_ec c
            FULL OUTER JOIN contentgroup_ec g
              ON c.group_id = g.contentgroup_id
           ORDER BY g.groupname ,c.title ASC );6. And also do search this forum. Most of your my queries are answered by simple search.
    Thanks,
    Karthick.

  • Help Needed In SQL Query

    HI All,
    Oracle sql clarification required
    Sample Table:
    empno empname Job mgr_id hire_date salary deptno
    7788 SCOTT ANALYST 7566 19-APR-87 3000 20
    7902 FORD ANALYST 7566 03-DEC-81 3000 20
    7934 MILLER CLERK 7782 23-JAN-82 1300 10
    7900 JAMES CLERK 7698 03-DEC-81 950 30
    7369 SMITH CLERK 7902 17-DEC-80 800 20
    7876 ADAMS CLERK 7788 23-MAY-87 1100 20
    Need "single / one" sql for this requirement statement:
    There will be 2 drop down boxes (1st - Job list, 2nd - empno) in the form in which the following result set is expected
    1) When user selects value from 1st drop down box (job) as "ANALYST" leaving the second drop down unselected, the result expected is 2 (no. of rows for that job)
    2) When user selects value from 1st drop down box (job) as "ANALYST" and the value from 2nd drop down box as 7902, the result expected is 1 (no of rows for that job and empno)
    Sqls which I have tried from my side (given below) didn't give the expected result and please do help me in correcting this
    select count(1) from scott.emp where job='ANALYST' and ( empno = :empno or empno is null ) ;
    Please help for this requirement. Any help is deeply appreciated.
    Thanks
    Zaheer

    Hi,
    welcome to the forum.
    Please read SQL and PL/SQL FAQ
    When you put some code or output please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    For your question the following will both work:SQL> select * from emp
    where job='ANALYST' and (empno =:empno or :empno is null)
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7788 SCOTT ANALYST 7566 19/04/1987 00:00:00 3000 20
    7902 FORD ANALYST 7566 03/12/1981 00:00:00 3000 20
    2 rows selected.
    SQL> select * from emp
    where job='ANALYST' and empno =NVL(:empno, empno)
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7788 SCOTT ANALYST 7566 19/04/1987 00:00:00 3000 20
    7902 FORD ANALYST 7566 03/12/1981 00:00:00 3000 20
    2 rows selected.
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Help needed in SORTING query

    I have a table having single column c1 of varchar2(10) and have stored these values in the table.
    A0
    A1
    A01
    A100
    A101
    A102
    B10
    B99
    B100
    B101
    B102
    100
    120
    200
    I need to sort them in the order as given, can someone help please.
    Thanks

    select c
    from (select c, substr(c,1,1) c1, length(c) len, substr(c,2) c2 from xx)
    order by case when ascii(c1) < 65
    then ascii(c1)+100
    else ascii(c1)
    end, len, c2

  • Help needed in join query

    Hi Friends,
    I am not experienced sql developer, so can u guys help me . I want to display name from foll. tables
    Table A
    KeyID number PK
    Name
    Table B
    BID number pk
    KeyID
    ABC
    Table C
    CID - PK
    KeyID
    XYZ
    I want to display name from table A for matching keyid between Table A and B. If KeyID is null in Table B then I want to match with Table A with C.
    How can I write this query?

    But isn't that what Alessandro's query is doing ?
    Thanks for your help, but there is still one catch.
    What I want to do is, take key_id from table b, if it
    is null then take key_id from table c ...
    >>           when b.key_id is not null then
                   b.abc
              else
                        select xyz
                        from c ...
    ... and then match
    with table a
    >>                     ... where c.key_id = a.key_id
         end ...
    to get name from table a.
    >> select key_id,
         a.name,
         case
    Can you help me out ?
    I am trying ur existing query, ...Did you face any problem before posting ?
    pratz

Maybe you are looking for

  • Iphone not recognized by itunes or iphoto

    Help please! iTunes and iPhoto no longer recognizes my iphone 4. I have a MacBook Pro... I have checked for all software updates on both... IOS 7.0.2 on iphone is installed Latest version for iTunes installed (11.1.1 or something) The reason for inst

  • Problems with the items (control) in forms 9i (Re)

    Hello, I write this problem in a other post and but don't have any feedback about it(So I will give another try:-) ) The problem that I will describe don't happen all the time and is very rare but I want to know if it's a normal bug of forms or somet

  • White screen as soon as battery is fitted. please help!

    Hi Please help me... My curve has been fine until today when I locked the keypad then went to unlock it, a white screen was desplayed and the phone was unresponsive. I have tried taking out the battery and putting it back in...the first time i done t

  • Quiz not showing results

    I don't know why but I always have trouble with Quizzes in Adobe Presenter.  I recently published a new module and the quiz appears but it won't show the results and it won't advance to the final slide of the presentation after the quiz is complete. 

  • EAS Startup issue after OEPM 11 Installation and Configuration

    Hi All, EAS server is not starting up after the successfull installation and configuration of OEPM 11.1.1.2 Provider Services and Shared Services started fine and i was able to login to Shared Services console During eas startup individually from the