Need help on Select

Posted on the latest update on this thread everything in detail
Edited by: user_7000011 on Apr 22, 2009 5:20 AM

The below Select is being used for retreiving Groups and its members INFO in a SCHEMA.
Now,the data is selected based on various combinations passed in it.
The issue that I am refering to is
we need to find the GROUP--> which has 'abreu'-as a member of the group and
the admininstrator selected is 'DURAND'.These data are entered by the user.
-->Lastname 'abreu'--> as a MEMBER
AND
Lastname, 'DURAND'--> as a ADMIN of the group.
if I give both the values of admin last name: “abreu” and member last name: “Durand” at
the same time-it fails.
How could I handle this scenario where i get the data for
both the values of admin last name: “abreu” and member last name: “Durand” PASSED
in the SELECT?
here,it would give me the GROUP which has ABREU as the ADMIN
and DURAND as a member of the same group.
Insert into TEST_GROUP
   (GROUP_ID, GROUP_ORG_ID, GROUP_NAME, PARENT_GROUP_ID,
    GROUP_LEVEL, GROUP_DESCRIPTION, MEMBER_COUNT, IN_USE_FLAG, GROUP_NAME_KEY,
    GROUP_DESCRIPTION_KEY, STATUS_CODE, UPDATED_DT, UPDATED_BY, CREATED_DT,
    CREATED_BY)
Values
   ('9999', '1111', 'Test_group', '8888',
    0, 'Test_group', 3, '0', NULL,
    NULL, NULL, NULL, NULL, NULL,
    NULL);
COMMIT;
Insert into TEST_GROUP_MEMBER
   (GROUP_ID, PERSON_ID, ISADMIN, UPDATED_DT, UPDATED_BY,
    CREATED_DT, CREATED_BY)
Values
   ('9999', '1', 1, NULL, NULL,
    NULL, NULL);
Insert into TEST_GROUP_MEMBER
   (GROUP_ID, PERSON_ID, ISADMIN, UPDATED_DT, UPDATED_BY,
    CREATED_DT, CREATED_BY)
Values
   ('9999', '2', 0, NULL, NULL,
    NULL, NULL);
Insert into TEST_GROUP_MEMBER
   (GROUP_ID, PERSON_ID, ISADMIN, UPDATED_DT, UPDATED_BY,
    CREATED_DT, CREATED_BY)
Values
   ('9999', '3', 0, NULL, NULL,
    NULL, NULL);
COMMIT;
Insert into TEST_GROUP_RELATIONSHIP
   (PARENT_GROUP_ID, CHILD_GROUP_ID, UPDATED_DT, UPDATED_BY, CREATED_DT,
    CREATED_BY)
Values
   ('8888', '9999', TO_DATE('03/20/2009 14:54:25', 'MM/DD/YYYY HH24:MI:SS'), '195723', TO_DATE('03/20/2009 14:54:25', 'MM/DD/YYYY HH24:MI:SS'),
    '195723');
COMMIT;
Insert into TEST_PERSON
   (PERSON_ID, FIRSTNAME, LASTNAME, MIDDLENAME, SOCSECNUMBER,
    BIRTHDAY,
    CREATED_BY,
    UPDATED_BY, CREATED_DT, UPDATED_DT, LASTNAME_KEY, FIRSTNAME_KEY)
Values
   ('1', 'test', 'durand', NULL, NULL,
    TO_DATE('12/29/1900 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, 'durand', 'test');
Insert into TEST_PERSON
   (PERSON_ID, FIRSTNAME, LASTNAME, MIDDLENAME, SOCSECNUMBER,
    BIRTHDAY,
    CREATED_BY,
    UPDATED_BY, CREATED_DT, UPDATED_DT, LASTNAME_KEY, FIRSTNAME_KEY)
Values
   ('1', 'test', 'abreu', NULL, NULL,
    TO_DATE('12/29/1950 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), NULL, NULL, NULL, NULL,
    NULL, NULL, NULL, 'abreu', 'test');
COMMIT;
**Select statement starts here****
SELECT
DISTINCT
grp.group_id,
grp.group_name,
grp.group_description,
grp.status_code,
grp.member_count,
                (SELECT gp.group_name
                   FROM TEST_group gp
                  WHERE gp.GROUP_ID = gr.parent_group_id)
                                                         AS parent_group_name,
                grp.group_name_key, grp.group_description_key,pp.FIRSTNAME,pp.LASTNAME
                FROM TEST_person pp
                LEFT JOIN TEST_org_person op
                ON pp.person_id = op.o_person_id
                LEFT JOIN TEST_group_member mem ON pp.person_id = mem.person_id
                LEFT JOIN TEST_group grp ON mem.GROUP_ID = grp.GROUP_ID
                LEFT JOIN TEST_group_relationship gr
                ON gr.child_group_id = grp.GROUP_ID
               WHERE grp.group_org_id = '1111'
            --AND REGEXP_LIKE (grp.group_name_key, '^.*' || #name#, 'i')
            --AND REGEXP_LIKE (grp.group_description_key,
--                             '^.*' || #description#,
--                             'i'
--            AND grp.status_code = #statuscode#
            AND (    REGEXP_LIKE (pp.lastname, '^.*' || 'abreu', 'i')
                 AND mem.isadmin = 1
--            AND (    REGEXP_LIKE (pp.firstname, '^.*' || #adminfirstname#,
--                                  'i')
--                 AND mem.isadmin = 1
--            AND (    REGEXP_LIKE (op.emplid, '^.*' || #adminemployeeid#, 'i')
--                 AND mem.isadmin = 1
            AND (    REGEXP_LIKE (pp.lastname, '^.*' ||'durand', 'i')
                 AND mem.isadmin = 0
--            AND (    REGEXP_LIKE (pp.firstname,
--                                  '^.*' || #memberfirstname#,
--                                  'i'
--                 AND mem.isadmin = 0
--            AND (    REGEXP_LIKE (op.emplid, '^.*' || #memberemployeeid#, 'i')
--                 AND mem.isadmin = 0
--                )Edited by: user_7000011 on Apr 22, 2009 5:21 AM

Similar Messages

  • Need help [JS]: select images/captions in InD, switch to Bridge and write to XMP

    I've got a javascript for CS3/Tiger that I'm writing that eventually will let a user select an image and a caption in InDesign, then tells bridge to write the caption data into the image metadata. I need help - the script works in pieces, but not when put together.
    It's built as an indesign script, then follows the procedure to create a script object to send to bridge. When it runs, the indesign portion works fine, but nothing happens in bridge.
    The script is below, with comments.
    Can someone help!? Thanks.
    // This is the InDesign portion of the script, which was tested separately and is working fine. Right now, for testing purposes, the data from this portion isn't even used by the later Bridge portion but once I get the bridge part together, it will use those variables.
    #target "indesign-5.0"
    var myObjectList = new Array;
    //Script does nothing if no documents are open or if no objects are selected.
    if(app.documents.length != 0){
    if(app.selection.length != 0){
    for(myCounter = 0; myCounter < app.selection.length; myCounter ++){
    switch(app.selection[myCounter].constructor.name){
    case "TextFrame":
    var myCaption = app.selection[myCounter].contents;
    $.writeln(myCaption);
    break;
    default:
    var myLink = app.selection[myCounter].graphics[0].itemLink.filePath;
    $.writeln(myLink);
    // here's where I create the string of the script to send to Bridge.
    // the script itself is almost completely a lifted from the SnpModifyMetadta sample from the Bridge sdk
    // it basically finds a certain image file and modifies the description metatata. i hardcoded the caption text and image path just for testing- eventually i would like it to use the variables from indesign.
    // this script works fine as-is when run in the original Bridge scripting context.
    // the method here of concatenating and sending the myScript string works fine when i use a different (smaller) script. so i can't tell why it's not working!?
    var myScript = "function SnpModifyMetadata()";
    myScript += "{";
    myScript += " this.requiredContext = \"Needs to run in Bridge, \nwith a selection of a file, \nideally with some metadata\";";
    myScript += "}";
    myScript += "SnpModifyMetadata.prototype.run = function()";
    myScript += "{";
    myScript += " if(!this.canRun())";
    myScript += " {";
    myScript += " return false;";
    myScript += " }";
    myScript += " if( xmpLib == undefined )";
    myScript += " {";
    myScript += " if( Folder.fs == \"Windows\" )";
    myScript += " {";
    myScript += " var pathToLib = Folder.startup.fsName + \"/AdobeXMPScript.dll\";";
    myScript += " }";
    myScript += " else";
    myScript += " {";
    myScript += " var pathToLib = Folder.startup.fsName + \"/AdobeXMPScript.framework\";";
    myScript += " }";
    myScript += " var libfile = new File( pathToLib );";
    myScript += " var xmpLib = new ExternalObject(\"lib:\" + pathToLib );";
    myScript += " }";
    myScript += " $.writeln(\"About to run SnpModifyXML\");";
    myScript += " var thumb = new Thumbnail(Folder(\"/Macintosh HD/Users/hearstuser/Desktop/BridgeScriptImages/orion_stack copy 6.psd\"));";
    myScript += " if(thumb.hasMetadata)";
    myScript += " {";
    myScript += " var md = thumb.synchronousMetadata;";
    myScript += " var xmp = new XMPMeta(md.serialize());";
    myScript += " $.writeln(\"SnpModifyXML: About to modify XMP data for \" + thumb.name);";
    myScript += " $.writeln(\"XMP packet before modifications:\");";
    myScript += " $.writeln(\"-------------------------------------------------\");";
    myScript += " $.writeln(xmp.dumpObject());";
    myScript += " xmp.deleteProperty(XMPConst.NS_XMP, \"Description\");";
    myScript += " xmp.setProperty(XMPConst.NS_XMP, \"Description\", \"hoThereHeyThere\");";
    myScript += " var d = new XMPDateTime(new Date());";
    myScript += " d.convertToLocalTime();";
    myScript += " xmp.setProperty(XMPConst.NS_XMP, \"ModifyDate\", d, XMPConst.XMPDATE);";
    myScript += " $.writeln(\"XMP packet af

    Recently I received an e-mail from a user asking me to remake the script I had posted here a while ago.
    I rechecked my previous post and found a couple of serious mistakes. So I revised it according to what he asked. Each page in his InDesign document contains one image and one text frame with description.
    At start the script checks the selection. If nothing is selected it processes all pages in the document. In case two objects are selected – it checks whether one of them text frame and the other a rectangle and if the rectangle contains an image, then it reads the contents of the text frame, replacing hard and soft returns with spaces and writes this text to the corresponding image’s description field.
    In the end, it updates all links and saves the file.
    The script works both on Mac and PC, assuming that CS3 installed in the default location so long as it depends on libraries:
    /C/Program Files/Adobe/Adobe Bridge CS3/AdobeXMPScript.dll (on PC)
    /Applications/Adobe Bridge CS3/Bridge CS3.app/Contents/MacOS/AdobeXMPScript.framework (on MAC)
    So, if necessary, correct these lines.
    Here is my script in case somebody is interested:
    #target indesign
    var myDoc = app.activeDocument;
    var mySelection = app.selection;
    if (mySelection.length == 0) {
        ProcessPages();
    else if (mySelection.length == 1) {
        alert("One image and one textframe should be selected.");
        exit();   
    else if (mySelection.length == 2) {
        try {
            if (mySelection[0].constructor.name == "TextFrame" && mySelection[1].images.length == 1) {
                var myTextFrame = mySelection[0];
                var myImage = mySelection[1].images[0];
                var myCaption = ReplaceReturnWithSpace(myTextFrame.contents);
                var myPath = new File(myImage.itemLink.filePath).absoluteURI;
            else if (mySelection[1].constructor.name == "TextFrame" && mySelection[0].images.length == 1) {
                var myTextFrame = mySelection[1];
                var myImage = mySelection[0].images[0];
                var myCaption = ReplaceReturnWithSpace(myTextFrame.contents);
                var myPath = new File(myImage.itemLink.filePath).absoluteURI;
        catch(e) {
            alert("Something wrong with your selection.\nError: " + e.message);
            exit();
        CreateBridgeTalkMessage(myCaption, myPath);
    else if (mySelection.length > 2) {
        alert("One image and one textframe should be selected.");
        exit();
    UpdateAllOutdatedLinks();
    myDoc.save();
    alert("All done.");
    //+++++++++++++++++++ FUNCTIONS ++++++++++++++++++++++
    function CreateBridgeTalkMessage(myCaption, myPath) {
        var bt = new BridgeTalk();
        bt.target = "bridge";
        var myScript = WriteCaption.toString() + '\r';
        myScript += 'WriteCaption(\"' + myCaption + '\", \"' + myPath + '\");';
        bt.body = myScript;
        bt.send();
    function WriteCaption(myCaption, myPath) {
        if( xmpLib == undefined ) {
            if( Folder.fs == "Windows") {
                var pathToLib = "/C/Program Files/Adobe/Adobe Bridge CS3/AdobeXMPScript.dll";
            else {
                var pathToLib = "/Applications/Adobe Bridge CS3/Bridge CS3.app/Contents/MacOS/AdobeXMPScript.framework";
            var libfile = new File( pathToLib );
            var xmpLib = new ExternalObject("lib:" + pathToLib );
        var thumb = new Thumbnail (File (myPath));
        if (thumb.hasMetadata) {
            var md = thumb.synchronousMetadata;
            var xmp = new XMPMeta(md.serialize());
            xmp.deleteProperty(XMPConst.NS_XMP, "Description");
            xmp.setProperty(XMPConst.NS_XMP, "Description", myCaption);
            var updatedPacket = xmp.serialize(XMPConst.SERIALIZE_OMIT_PACKET_WRAPPER | XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
            thumb.metadata = new Metadata(updatedPacket);
    function ProcessPages() {
        var myPages = myDoc.pages;
        for (i = 0; i < myPages.length; i++) {
            var myPage = myPages[i];
            if (myPage.textFrames.length == 1 && myPage.rectangles.length == 1) {
                if (myPage.rectangles[0].graphics.length == 1) {
                var a = myPage.rectangles[0];
                    var myImage = myPage.rectangles[0].graphics[0];
                    var myPath = new File(myImage.itemLink.filePath).absoluteURI;
                    var myTextFrame = myPage.textFrames[0];
                    var myCaption = ReplaceReturnWithSpace(myTextFrame.contents);
                    CreateBridgeTalkMessage(myCaption, myPath);
    function ReplaceReturnWithSpace(myString) {
        myString = myString.replace( /\n/g , " " );
        myString = myString.replace( /\r/g , " " );
        return myString;
    function UpdateAllOutdatedLinks() {
        for(var myCounter = myDoc.links.length-1; myCounter >= 0; myCounter--){
            var myLink = myDoc.links[myCounter];
            if (myLink.status == LinkStatus.linkOutOfDate){
                myLink.update();
    If somebody interested in developing this script further, do not hesitate to post here your feedback.
    Kasyan

  • Need help regarding SELECT statement

    Hello, first time here but need help badly.
    I been using SQL syntax with another SQL server by the following statement doesnt seem to work in Oracle database.
    SELECT firstname+" "+lastname AS fullname FROM customers
    basicially, I just want to display date from two column as one column.
    Thanks

    Oracle has pipe sign for concate
    SELECT firstname||' '||lastname AS fullname
    FROM customers;Khurram

  • Need help on select statement...

    Hi,
    I need to fetch from vbfa table those records where vbeln starts with '0800'.
    my select statement given below gives a syntax error..pl help.
    SELECT * FROM vbfa WHERE vbeln(4) = '0800'.
    vbeln(4) is not accepted and i get the message ' field vbeln(4) is unknown' ...what to do?
    thks

    Use LIKE. Please see F1 on this.
    Rob
    (changed CP to LIKE)
    Edited by: Rob Burbank on Sep 15, 2008 11:18 AM

  • Need help on selection screen optation

    1)PARAMETER: P_DETAIL RADIOBUTTON GROUP G1 DEFAULT 'X'.
    2)PARAMETER: P_SUMM RADIOBUTTON GROUP G1
    3)SELECT-OPTIONS: S_PGI FOR ZAPDDLIV-ZDATE
    i have 2 parameters depending on parameter i need to accept selection screen for parameter 1 accept data in dd.mm.yyyy. and for parameter need to accept only mm.yyyy
    only
    need help on this selection criteria..

    Hi Anil,
    It is very much possible. Use Modif ID concept. First dont display any date, depending on radio button selected display date in which ever form u need.
    See the sample coding for Modif id.
    PARAMETERS: test1(10) TYPE c MODIF ID sc1,
                test2(10) TYPE c MODIF ID sc2,
                test3(10) TYPE c MODIF ID sc1,
                test4(10) TYPE c MODIF ID sc2.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF screen-group1 = 'SC1'.
          screen-intensified = '1'.
          MODIFY SCREEN.
          CONTINUE.
        ENDIF.
        IF screen-group1 = 'SC2'.
          screen-intensified = '0'.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    Dont forget to reward points if found useful.
    Thanks,
    Satyesh

  • Need help with select within select - daterange

    I use Crystal Reports v12.3.0.601 - I am a beginner.
    Problem:
    TABLE: ACCOUNTBILLFEE
    Columns are   
    FOLDERRSN
    STAMPDATE
    BILLNUMBER
    PAYMENTAMOUNT
    There are over 500,000 rows/ records...
    And I need to report the FOLDERRSN which has at least one {ACCOUNTBILLFEE.STAMPDATE} in DateTime
    (2014, 05, 01, 00, 00, 01) to DateTime (2014, 05, 31, 23, 59, 59)
    Out-put required is:
    FOLDERSN | STAMPDATE | BILLNUMBER   | PAYMENTAMOUNT
    Group by FOLDERRSN
    1010234               May01,2014                 1111                      25000
                                  May25, 2014                1112                       5000
                                  Jan 05, 2013                  998                          500
    1034567                May5, 2014                11325                       5000
    1033999                May15, 2014               6752                       15000
                                  Dec5 , 2011                1132                       25000
    Please help -
    The critical part for me, is to display  payments not within the date range in 'select expert' statement.
    Currenlty my report reflects only payments for FOLDERRSN, where {ACCOUNTBILLFEE.STAMPDATE} in DateTime
    (2014, 05, 01, 00, 00, 01) to DateTime (2014, 05, 31, 23, 59, 59) and not other payments outside the date range specified.
    Thank you for your time.

    Hi Abilash,
    This worked !!!
    My brother helped me with it here....ofcourse you have intiated the intial idea.
    It worked when i used the following SQL at 'Add Command'
    Select * from DATABASE_NAME.ACCOUNTBILLFEE A
    Where A.FOLDERSN = any ( select B.FOLDERSN from DATABASE_NAME.ACCOUNTBILLFEE B
    where B.STAMPDATE >= TO_DATE('20140501', 'YYYYMMDD')
    AND  B.STAMPDATE <= TO_DATE('20140531', 'YYYYMMDD'))
    Excellent support - Thank you so much for your immediate attention and response.
    I know, how hard it is to understand someones requirement and suggest solutions.
    You are the best and most helpful I have ever come across in my life.
    Thank you for your kind heart and extending help to me.
    Regs,
    Sridhar Lam

  • Need help with selection.

    Hi all,
    I am working on a project and I want help
    I want to select letter from a word. 
    For example i store the word "Project" , I want a code to select the letters from the word like P r o j e c t  and store them in an array.

    Hello,
    We'll be pleased to help you but you do need more details about your question.
    Are you talking about Microsoft scheduling solution MS Project? In case you're not, please post your question in the appropriate forum.
    If you are, is it the Server version or standalone? Where is the word you want to copy? Which technology to you use?
    Guillaume Rouyre - MBA, MCP, MCTS

  • Need help on selection of records in dynamically created table

    hi,
    Ia m able to bind the onleadSelect event to the dynamially created table .
    But i was not able to select the table records.
    default first record was only selected.
    can u help me out to find the way.
    i am pasting the code for reference.
    can u suggest me the right direction.
    i want the selected record in the table to be dispalyed in another view thru this action event.
    but only the forst record is now getting selected by default.
    here the code.
    IWDNode node =wdContext.currentContextElement().node().getChildNode(nodename,0);
    for (int l = 0; l < node.size(); l++) {
    int ele = node.getLeadSelection();
    IWDNodeElement element= node.getElementAt(ele);
    table.setOnLeadSelect(wdThis.wdGetObjectSelectedAction());

    Hi,
      <a href="/people/sap.user72/blog/2005/05/09/have-you-played-blindfold-chess's</a> how to create a dynamic table, though I think you have already done this.
      Do look at the comment that Armin Reichert has put in. Now in the source code that he has provided, the last line should be
    table.setOnLeadSelect(wdThis.wdGetLeadSelectAction());
    Have you done something similar to this?
    Have you set the initializeLeadSelect property of the datasource node to true?
    Regards,
    Satyajit.
    Message was edited by: Satyajit Chakraborty

  • Need help in Select Query

    Hello,
    I am using oracle 9i and windows XP:
    Please help me to making a query to get output as mentioned below:
    create table myt(col1 varchar2(10));
    insert into myt values('TABLE1');
    insert into myt values('TABLE2');
    insert into myt values('TABLE3');
    COMMIT;
    create table table1(name varchar2(10),amount number);
    create table table2(name varchar2(10),amount number);
    create table table3(name varchar2(10),amount number);
    insert into table1 values('James',1000);
    insert into table1 values('David',1500);
    insert into table1 values('James',2000);
    insert into table1 values('David',1735);
    insert into table2 values('Menon',500);
    insert into table2 values('Martin',700);
    COMMIT;
    Required Output:
    Table Name
    Table1
        James: 3000
        David: 3235
        Sum:   6235
    Table2
        Menon:  500
        Martin: 700
        Sum:   1200
             -------Regards

    In your solution i added some modifications and got the output:
    declare
    cr_lf varchar2(2) := chr(13) || chr(10);
    the_cursor sys_refcursor;
    the_sql varchar2(4000) := 'select * from ' || cr_lf || '(' || cr_lf;
    a_table varchar2(10);
    ln varchar2(10);
    a_name varchar2(10);
    an_amount number:=0;
    tan_amt number:=0;
    i number;
    j varchar2(4000);
    begin
    for the_row in (select col1 from myt) loop
    the_sql := the_sql || 'select ''' || the_row.col1 || ''',name,sum(amount) from ' || the_row.col1 || ' group by name ' || cr_lf;
    the_sql := the_sql || 'union all' || cr_lf;
    end loop;
    the_sql := substr(the_sql,1,length(the_sql) - 11) || ')' || cr_lf;
    i := 1;
    j := instr(the_sql,cr_lf,i);
    while i > 0 loop
    exit when j = 0;
    dbms_output.put_line(substr(the_sql,i,j - i));
    i := j + 2;
    j := instr(the_sql,cr_lf,i);
    end loop;
    dbms_output.put_line(substr(the_sql,i));
    --dbms_output.put_line(the_sql);
    open the_cursor for the_sql;
    dbms_output.put_line('--------------------------------------------------------------------------');
    dbms_output.put_line(rpad('TABLE',20) || ' ' || rpad('NAME',20) || ' ' || rpad('AMOUNT',20));
    dbms_output.put_line('--------------------------------------------------------------------------');
    loop
    ln:= a_table;
    fetch the_cursor into a_table,a_name,an_amount;
    exit when the_cursor%notfound;
    if ln<>a_table then
    dbms_output.put_line('--------------------------------------------------------------------------');
    dbms_output.put_line(rpad('SUM',40) || lpad(to_char(tan_amt),10));
    dbms_output.put_line('--------------------------------------------------------------------------');
    tan_amt:=0;
    end if;
    tan_amt:= tan_amt+an_amount;
    dbms_output.put_line(rpad(a_table,20) || ' ' || rpad(a_name,20) || ' ' || rpad(an_amount,20));
    end loop;
    dbms_output.put_line('--------------------------------------------------------------------------');
    --dbms_output.put_line(rpad('SUM',45) || to_char(tan_amt));
    dbms_output.put_line(rpad('SUM',40) || lpad(to_char(tan_amt),10));
    dbms_output.put_line('--------------------------------------------------------------------------');
    close the_cursor;
    end;
    select * from
    select 'TABLE1',name,sum(amount) from TABLE1 group by name
    union all
    select 'TABLE2',name,sum(amount) from TABLE2 group by name
    union all
    select 'TABLE3',name,sum(amount) from TABLE3 group by name
    TABLE                  NAME                  AMOUNT
    TABLE1                 David                  6470
    TABLE1                 James                  6000
    SUM                                          12470
    TABLE2                 Martin                 1400
    TABLE2                 Menon                  1000
    SUM                                           2400
    --------------------------------------------------------------------------So many thanks for providing solution to me.
    Regards

  • Need help on select statement in ABAP

    Hi,
    I have 2 table. in that I need to do join. But 2 fields of table A that I need to join with the 2 fields in table B.
    But problem is that both the fields of table A can be NULL(either of them).
    i.c.
                          Table A                                                                      Table B
    KONDA     KUNNR      PRICESHEET                                     KONDA       KUNNR
    KA             NULL           A                                                       KA            1000
    KA             NULL           B                                                       KA            1001
    DZ             NULL            C                                                      DZ             1002
    NULL         1000            D                                                       DZ             1003
    NULL         1001            E                                                       DZ             1004
    NULL         1002            F
    NULL         1003            F
    NULL         1004            G
    After Joining I need for KONDA = 'KA'
    KONDA     KUNNR      PRICESHEET 
    KA             NULL           A            
    KA             NULL           B
    NULL         1000            D 
    NULL         1001            E 
    Could you plz help me...Plz reply soon. Thanks in advance
    Regards
    Anutosh

    select a~konda a~kunnr a~pricesheet  from table_a as a
    join table_b as b on ( a~konda = b~konda or a~konda eq space ) and (a~kunnr = b~kunnr or a~kunnr eq space )
    where b~konda = 'KA'.
    Try that
    Edited by: Ramiro Escamilla on Apr 3, 2008 11:48 PM

  • Need Help in Select Statement

    Dear gurus
    Below is my select statement. Im having problem with statement.
    the problem is that  the table vbfa  have some entries like this
    800     1400004654     10     3900012235     10     M     424,672.68
    800     1400004654     10     3900012257     10     M     137,093.36
    800     1400004654     20     3900012311     20     M     214,257.36
    800     1400004654     30     3900012412     30     M     81,248.44
    800     1400004654     30     3900012901     30     M     166,920.68
    When the select statement is run it does not fetch the data of LINE number 2 and Line number 5
    LOOP AT itab1.
        SELECT SINGLE * INTO CORRESPONDING FIELDS OF wa_vbfa
        FROM vbfa
        WHERE vbelv = itab1-vgbel
        AND posnn = itab1-vgpos
        AND vbtyp_n = 'M'.
        SELECT SINGLE * INTO CORRESPONDING FIELDS OF wa_vbrk
          FROM vbrk
          WHERE vbeln = wa_vbfa-vbeln
          AND vbtyp = 'M'.
        IF sy-subrc = 0.
            itab1-lfimg = wa_vbfa-rfmng.
           itab1-old_price = wa_vbfa-rfwrt.
           MODIFY itab1.
           ELSE.
        ENDIF.
      ENDLOOP.
    Please Help
    Regards
    Saad Nisar

    Hello Saad,
    The reason why you are not getting the 2nd and 5th entries is that, the where conditions vbelv, posnn and vbtyp_n matches for both the 1st and 2nd record where select will pick only the 1st record. The same way for 4th and 5th record. so its picking only 4th.
    So to avoid this add even vbeln in the where condition of the select query
    LOOP AT itab1.
        SELECT SINGLE * INTO CORRESPONDING FIELDS OF wa_vbfa
        FROM vbfa
        WHERE vbelv = itab1-vgbel
        AND posnn = itab1-vgpos
       AND vbeln = itab1-field           " Add the corresponding field here
        AND vbtyp_n = 'M'.
        SELECT SINGLE * INTO CORRESPONDING FIELDS OF wa_vbrk
          FROM vbrk
          WHERE vbeln = wa_vbfa-vbeln
          AND vbtyp = 'M'.
        IF sy-subrc = 0.
            itab1-lfimg = wa_vbfa-rfmng.
           itab1-old_price = wa_vbfa-rfwrt.
           MODIFY itab1.
           ELSE.
        ENDIF.
      ENDLOOP.
    Vikranth

  • Need help on Select statement/Formula

    Post Author: Krazy Kasper
    CA Forum: Data Connectivity and SQL
    My crystal report (Crystal Reports X) pulls about five thousand records/transactions. When any 2 transactions have every field the same except STATUS, I want to select from those 2 that transaction where STATUS = I.
    Appreciate any help you can provide.
    Krazy
    [email protected]

    Use LIKE. Please see F1 on this.
    Rob
    (changed CP to LIKE)
    Edited by: Rob Burbank on Sep 15, 2008 11:18 AM

  • Need help in selecting translations for bursting

    Hi,
    I am using EBS 12.1.3 (XML publisher 5.6.3) .I am successfully able to burst my consolidated report to e-mail in english language. But somehow I cannot get it to select the french translation ,for which I have already uploaded the corresponding xlf file for the template. I searched the forum and tried the filter attribute,so that my control file looks like this:
    <?xml version="1.0" encoding="UTF-8" ?>
    <xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi">
    <xapi:request select="/DATA/LIST_G_COUNT/G_COUNT">
    <xapi:delivery>
    <xapi:email server="10.96.9.132" port="25" from="[email protected]" reply-to="">
    <xapi:message id="123" to="[email protected]" attachment="true"
    subject="${NAME} GL Voucher Report">Please find attached herewith the GL Voucher Report for ${NAME}.
    </xapi:message>
    </xapi:email>
    </xapi:delivery>
    <xapi:document output-type="excel" delivery="123">
    <xapi:template type="rtf" locale="en-US" location="xdo://BTVL.XXBILCGLVCHR.en.US/?getSource=true"
    filter=".//G_COUNT[LANGUAGE='FR']" translation="XXBILCGLVCHR_fr_FR.xlf" />
    <xapi:template type="rtf" locale="en-US" location="xdo://BTVL.XXBILCGLVCHR.en.US/?getSource=true"
    filter=".//G_COUNT[LANGUAGE='FR']" translation="XXBILCGLVCHR_fr_FR.xlf" />
    </xapi:document>
    </xapi:request>
    </xapi:requestset>My report XML file structure is like this:
    <DATA>
           <PARAMETER1>value for Parameter1</PARAMETER1>
          <PARAMETER 7>value for Parameter 7</PARAMETER7>
          <LIST_G_COUNT>
                  <G_COUNT>
                  <FIELD1>Value for F1</FIELD1>
                  <LANGUAGE>US</LANGUAGE>
                  <LIST_G_VOUCHER_NUM>
                            <G_VOUCHER_NUM>
                                    <FIELD2>Value for F2</FIELD2>
                                    <FIELD7>Value for F7</FIELD7>
                            </G_VOUCHER_NUM>
                            <G_VOUCHER_NUM>
                                    <FIELD2>Value for F2</FIELD2>
                                    <FIELD7>Value for F7</FIELD7>
                            </G_VOUCHER_NUM>
                     </LIST_G_VOUCHER_NUM>
                     <CS_SUM>Value</CS_SUM>
                  </G_COUNT>
                  <G_COUNT>
                  </G_COUNT>
          </LIST_G_COUNT>
    </DATA>Oddly though, the bursting program errors out when I try to make it select any of the 2 languages using the above control file. It gives the message :
    Error while generating the Document...Any having any idea as to where i might be going wrong ?Any help will be appreciated.

    Hi Sarath
    Following package will help for find applied tax , charges and order total
    OE_OE_TOTALS_SUMMARY.PRT_ORDER_TOTAL (OOH.header_id),
    OE_OE_TOTALS_SUMMARY.Taxes (OOH.header_id),
    OE_OE_TOTALS_SUMMARY.Charges (OOH.header_id)
    Regards,
    akil

  • Need help in selecting data dynamically in combobox

    i am taking some values in combobox from database
    and i want that on selection of the option in 1st combobox the another set of values should come in 2nd combobox ,& that also from database
    i have saved the file as .php and also given the database in the zip file, to solve my problem please can anyone help me plz....
    the file link is - http://www.dandylink.com/combotest.zip
    advance thanks for any help.

    .php? Did you see the sign on the door when you came in? If you have some java code you want people to look, where java code is something stored in a .java file, then post it. Or, are you a hacker trying to spread viruses?

  • Need help with select statement or query

    Not familiar with what to call it, but here is what i need...
    To give our analyst a better idea of warranty on some of our
    equipment, i
    would like to add to the page a column that displays if the
    device is still
    under warranty
    I currently capture the date the equipment was returned from
    repair, so what
    could i use within my select statement or query to display a
    warranty
    expiration date or display on the page...
    example :
    Returned from repair 10/20/2006 warranty expires on
    11/20/2006
    each equipment has different warranties, so i need a formula
    or something to
    say... device #1 has 60 day warranty ( so 10/20/2006 + 60days
    =
    12/19/2006 )
    I would imagine this to be a query
    Table 1 would contain the equipment type and warranty time
    Table 2 would contain the current status of the equipment
    Query would take the back from repair date + warranty =
    expiration date

    Simple. Join the two tables and create a derived column for
    the expiration date. The exact syntax is dependant on your DBMS, so
    check the manual for whichever you are using and look at the date
    functions. There will be a function that will allow you to add a
    number of date units (day, month, year, etc) to a date
    field.

  • Need help using Select statement  to  retrieve one record

    Hi guys, my first post so be gentle please. The basis of this fucntion is to search my dtabase using the select statement to find the record the user wants, by retrieving the name of theitem from the text box. details are then displayed on a joption message box.
    Everytime I run this program it throws an exception 'Exception: null'. Can anyone see where I am going wrong, I have only bn learning java for thepast 6 months so perhaps I am doing something wrong.
    Or perhaps there is another way for me to close the st, con, rs?
    Your help appreciated
    public void searchproducts(){
    Connection con = null;
    Statement st = null;
    ResultSet rs = null;
    try{
    //creating and loading a database connection
    String dbUrl = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=db2.mdb;"; // String dbUrl = "jdbc:odbc:people";
    String user = "";
    String password = "";
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection c = DriverManager.getConnection(
    dbUrl, user, password);
    int count;
    st = con.createStatement();
    rs = st.executeQuery("SELECT ItemName, Country, Yearmade, ValuePrice, Forsale FROM Collectman WHERE ItemName="+" '"+txtsearchproduct.getText()+"'" );
    while(rs.next()) {
    String ItemName = rs.getString(1);
    String Country = rs.getString(2);
    String Yearmade = rs.getString(3);
    String ValuePrice = rs.getString(4);
    String Forsale = rs.getString(5);
    JOptionPane.showMessageDialog(null, "product details are: " + ItemName + " " + Country + " " + Yearmade + " " + ValuePrice + " " + Forsale);
    //It keeps on throwing this excpetion with null
    catch (Exception e) {
    System.err.println("Exception: " + e.getMessage());
    } finally {
    try {
    if(rs != null)
    rs.close();
    if(st != null)
    st.close();
    if(con != null)
    con.close();
    } catch (SQLException e) {
    }

    And while we're waiting on that, I'll just say it's nice to see you almost got the general layout of a db call correct...that's a rare thing around here. The finally should have a try/catch round each of the close statements and not around all three in one go. If the resultset throws an exception in your version then you would fail to close either the statement or the connection.
    The second thing is, look up PreparedStatements. They're a better choice for handling SQL requiring variables than using a bog standard Statement.

Maybe you are looking for

  • Saving image in windows 8.1 using stream and bitmap encoder id

    Hi var renderTargetBitmap = new RenderTargetBitmap(); await renderTargetBitmap.Render(myElementTree); var pixels = await renderTargetBitmap.GetPixelsAsync(); var picker = new FileSavePicker(); // Picker setup var file = await picker.PickSaveFileAsync

  • Sales Invoice Problem

    Dear All, We have create the two type of Sales Document 1) Regular Production Invoice 2) Job Work Invoice In this case there is no problem for Regular Invoice, but Job Work Invoice does create the excise document number because job work type of invoi

  • Database in connected mode

    Hi all, I am very new as apps dba(2 days). At the very first day i was told that while shutting down db it stays in 'connected mode' for a long time (3 hours) and it is happening from 2 days. I don't know what to do. plz help I am using 12.0.6 and 10

  • How to convert XML file to WSDL file

    Hi SAP gurus I am trying to create a wsdl file from a BAPI. I have followed all the steps and finally using transaction WSADMIN, I create the webservice. When I select SAVE AS (in the explorer window) it gives me an option with .XML. However, when I

  • G3 Ibook- Best Software Choices

    I have two new G3 Ibooks with 500mhz, 256 ram, 30 gig HD's, and DVD/CD-RW's. I want to know what would be the best choices for software as in: Mac OS iLife iTunes Safari Firefox ect. I basically want to know which ones will meet the requirements. Tha