Skip to Content
author's profile photo Former Member
Former Member

Question about creating a specific SELECT Statement

I am trying to create a SELECT statement where I use a date range for the same date column, I am having a difficult time creating an AND for the same column I thought maybe you guys could help, here is the XML I have so far.

<?xml version="1.0" encoding="UTF-8"?>

http://citgo.com/JDBC_to_CSL">

<STATEMENT>

<TABLENAME ACTION="SELECT">

<TABLE>qa_citgo_baseline.trd_header</TABLE>

<ACCESS>

<TRADE_NUM/>

<DEAL_NAME_STR/>

<COUNTERPART_COMPANY_NUM/>

<TRADE_TYPE_CD/>

<STRATEGY_NUM/>

<TRADE_INPUT_DT/>

<TRADE_DT/>

<ACCOUNTING_CLASS_CD/>

</ACCESS>

<KEY>

<TRADE_DT compareOperation="GTEQ">01-Jan-2008</TRADE_DT>

</KEY>

<KEY1>

<TRADE_DT compareOperation="LTEQ">08-Jan-2008</TRADE_DT>

</KEY1>

</TABLENAME>

</STATEMENT>

</ns0:MT_JDBC_TRDHEADER_REQ>

Is there anyway to do an AND instead of an OR.

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 12, 2008 at 02:50 PM

    Hi,

    I dont know how its possible........... bcoz its internally it use OR between two Key nodes.

    Check this:

    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm

    Thanks,

    Mahi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 12, 2008 at 02:57 PM

    hi,

    yes its posible:

    see this

    <StatementName1>

    <dbTableName action=u201DUPDATEu201D | u201CUPDATE_INSERTu201D>

    <table>realDbTableName</table>

    ............<access>

    ..................<col1>val1</col1>

    ..................<col2>val2new</col2>

    ............</access>

    ............<key1>

    ..................<col2>val2old</col2>

    ..................<col4>val4</col4>

    ............</key1>

    ............<key2>

    ..................<col2>val2old2</col2>

    ............</key2>

    ......</dbTableName>

    </StatementName1>

    UPDATE dbTableName SET col1=u2019val1u2019, col2=u2019val2newu2019 WHERE ((col2=u2019val2oldu2019 AND col4=u2019val4u2019) OR (col2=u2019val2old2u2019))

    the key1 represent "AND" and the key2 represent OR in the SQL query before. see this link please to undestand ir more clear

    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm

    in your case your query means

    <KEY>

    <TRADE_DT compareOperation="GTEQ">01-Jan-2008</TRADE_DT>

    </KEY>

    <KEY1>

    <TRADE_DT compareOperation="LTEQ">08-Jan-2008</TRADE_DT>

    </KEY1>

    <TRADE_DT compareOperation="GTEQ"> OR <TRADE_DT compareOperation="LTEQ">

    in your case, you cannot use AND and OR in same query because your field is the same, just the value change. you only can use OR.

    thats your doubt??

    Thanks

    Rodrigo

    Edited by: Rodrigo Alejandro Pertierra on Aug 12, 2008 11:57 AM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.