Query1

Hi All,
I have this query which is giving the result what I need, but when i put the date selection criteria in the query, it throws error;
"Must specify a table to specify from". Can anyone please tell me how do i get this query corrected??
SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T0.[DocTotal], A1.BED,A2.CESS ,A3.CST, A4.VAT,  
T0.[U_InvoiceNo], T0.[U_InvoiceDate]
FROM OPDN T0 left outer join dbo.bedgrpo a1  on T0.docentry =a1.Expr2
left outer join dbo.cessgrpo a2 on a1.Expr2 =a2.Expr2
left outer join dbo.CSTGRPO A3 on A2.Expr2=A3.Expr2
left outer join dbo.VATGRPO A4 on A3.Expr2= A4.Expr2
WHERE  ( T0.DocDate >= [%0] AND  T0.DocDate <= [%1] ) and
T0.[DocStatus] = 'O'
Thanks in advance,
Joseph

Hi!
Try this
Declare @FromDate Datetime
Declare @ToDate Datetime
Set @FromDate = (select min(T0.DocDate) from OPDN T0 Where T0.Docdate >= '[%0]')
Set @ToDate = (Select max(T0.Docdate) from OPDN Where T0.DocDate <='[%1]')
SELECT T0.DocNum, T0.DocDate, T0.CardCode, T0.CardName, T0.DocTotal, A1.BED,A2.CESS ,A3.CST, A4.VAT,
T0.U_InvoiceNo, T0.U_InvoiceDate
FROM OPDN T0 left outer join dbo.bedgrpo a1 on T0.docentry =a1.Expr2
left outer join dbo.cessgrpo a2 on a1.Expr2 =a2.Expr2
left outer join dbo.CSTGRPO A3 on A2.Expr2=A3.Expr2
left outer join dbo.VATGRPO A4 on A3.Expr2= A4.Expr2
WHERE T0.DocStatus = 'O' and
T0.DocDate >= @Fromdate and T0.DocDate <= @ToDate
If this shows error , please mention the error in your reply.

Similar Messages

  • Prob in joining Query1 and Query2 in Data Model

    Hi,
    I m facing a prob. in joining Multiple queries
    Under data model I've created 2-3 queries which I've to join internally and in my Query1 only 1 bind variable is there, for which i've created a parameter
    but for Query2 and Query3 I m going to user one column value of Query1 as parameter.
    When i m doing this the Xml formed returns only Query1 value and Query2 and Query3 comes as blank.
    Eg.
    Query1 : select deptno,dname from dept where deptno=:p_deptno <:p_deptno is a parameter created in parameter list>
    Query2 : select empno,ename,mgr from emp where deptno=:deptno <where :deptno, i m expecting to come from Query1>
    but it not happening
    whereas my Xml comes as display below:
    <DATA>
    <Q2>
    <Q2_ROW>
    <DEPTNO>10</DEPTNO>
    <DNAME>ACCOUNTING</DNAME>
    </Q2_ROW>
    </Q2>
    <Q1 />
    </DATA>
    tanks in advance for replying
    Regards/goutam

    Personally, I have had a hard time doing what you are asking for using netui tags. I have had the same case, and asked the person in my team to just return a collection of value objects and then iterate through it without the repeater tag. To use the checkbox, I have had to use a String[].
              Kunal

  • No data to retrieve Query1

    Hi,
    We have a typical issue, we work on webi report from BI Launch Pad, Our client User created a 2 users to access and design webi reports. 1 User is able to run the query and able to get results of the query and report is running fine. Whereas other user created with same rights as 1st User. But the 2nd user is able to login to Launchpad and Open WEBI, but when running the query the resuly is showing as "No data to retrieve Query1"
    Can any one suggest what and where we are missing.
    Regards
    Kumar

    Hi Kumar.
    If the user who gets data can log in on the other users computer and run the report there - do they get data?
    If you are using BEX, is there any chance the user has personalised a variable in BEx making the selection in valid.
    Again if you are using BEx, do they get values if they run the query in Analyser.
    With regards
    Gill

  • APP Query1

    Dear gurus,
    we have two company codes in two different countries. In company1  we have a vendor and he also a customer in company2. If i want to make the payment to vendor in company1 through APP, how can i subtract cutomer balance from company2?
    Thanks in advance
    N.M.B

    Hi,
    As requested, message F3063
    Company code 4520 is not permitted as the paying company code
        Message no. F3063
    Diagnosis
        The paying company code and the company code on whose behalf the payment
        is being made must be in the same country, have the same local currency,
        and display the same currencies managed in parallel. The setting
        regarding extended withholding tax functions (active or not active) must
        also be identical for both company codes.
    System Response
        The entry is not accepted since these requirements are not met.
    Procedure
        Correct your entry.
    regards,
    radhika

  • How to create dynamics columns in oracle query1.

    hi,
    how to create dynamics columns in oracle query.its very urgent.
    regards
    prasad..

    Urgent is it?
    Why? Have you forgotten to do your coursework and you'll get thrown off your course if you don't hand it in today?
    What makes you believe that your request for help is more important than someone else who has requested help? It's very rude to assume you are more important than somebody else, and I'm sure they would like an answer to their issue as soon as they can get one too, but they've generally been polite and not demanded that it is urgent.
    Also, you assume that people giving answers are all sitting here just waiting to answer your question for you. That's not so. We're all volunteers with our own jobs to do. How dare you presume to demand our attention with urgency.
    If you want help and you want it answering quickly you simply just put your issue forward and provide as much valuable information as possible.
    Looking at your post you haven't told us what database version you are using, you haven't provided any create table DDL's and insert statements to populate that with sample data, and you haven't even shown us that you've had a go at doing something yourself.
    You will find if you post on here demanding your post is urgent then most people will just ignore it, some will tell you to get lost, and some will explain to you why you shouldn't post "urgent" requests. Occasionally you may find somebody who's got nothing better to do who will actually provide you with an answer, but you really are limiting your options by not asking properly.
    /rant
    As a basic example of dyanamic SQL:
    DECLARE
      cur PLS_INTEGER := DBMS_SQL.OPEN_CURSOR;
      cols DBMS_SQL.DESC_TAB;
      ncols PLS_INTEGER;
    BEGIN
      -- Parse the query.
      DBMS_SQL.PARSE(cur, 'SELECT hiredate, sal FROM emp', DBMS_SQL.NATIVE);
      -- Retrieve column information
      DBMS_SQL.DESCRIBE_COLUMNS (cur, ncols, cols);
      -- Display each of the column names
      FOR colind IN 1 .. ncols
      LOOP
        DBMS_OUTPUT.PUT_LINE (cols.col_name);
      END LOOP;
      DBMS_SQL.CLOSE_CURSOR (cur);
    END;
    /

  • Error while Scheduling Precalculation settings

    Hi All,
    I have made workbook settings for Precalculation server.
    What I did:
    I have made a variable in query 2 on one of the characteristics and Given the Processing type as 'Replacement path' .NOw in the replacement path Tab, I hve given 'Query' as input in 'Replace with' option and mentioned the query name (query1) whose output I want to assign to this variable.
    Am I going correctly?
    After this is done,I did settings in the Broadcaster for precalculation.
    When I executed that settings I am getting the following error:
    Error Description:Wrong number of arguments
    Wrong ID property assignment
    Result: Failse
    End of MenuRefreshPrecal
    Precalculation in thread 4 failed
    Cannot precalculate workbook.
    I am unable to find out where I am wrong?
    Can anybody please tell me the complete step by step process for this starting from creating variable?I know it'll be too lengthy but I am totally new to this & cannot understan what to follow afer what????
    If somebody has the screenshots for the same, can send me on ompreet_nandra at hotmail.
    Plz help........
    Thanks
    Preet

    Unfortunately the error comes out immediately after the menu selection: if there's an options panel, it doesn't show 
    Tomorrow I'll be out of office, but next wednesday I'll try to run the tool from the command line and see what happens. In the meanwhile if you have any further suggestion I'll be glad to hear it.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Logical operator in datatemplate query

    Hi,
    I'm having trouble writing my queries in a datatemplate. The problem is, when I have to use the logical operators <>. More specific, my sql query has a less than condition, but when I try to save the datatemplate with my query, I get an error message saying that the datatemplate is invalid.
    It's obvious that the characters &lt; and &gt; will result in non well formed xml, but is there any solution to this?
    Thx in advance
    Kim
    Edited by: mulder82 on Mar 30, 2009 1:33 AM

    Hi,
    Can you post your data template please?
    < and > don't pose a problem for the xml structure because they should be inside a "CDATA" element.
    Like this:
    <dataTemplate name="dataTemp">
         <parameters>
              <parameter name="P_PARAM" dataType="character" defaultValue=""/>
              <parameter name="P_PYS_ID" dataType="character" defaultValue=""/>
         </parameters>
         <dataQuery>
              <sqlStatement name="Query1">
                   <![CDATA[
    SELECT name
    FROM dept
    WHERE dept_no > 10
    ]]>
              </sqlStatement>
         </dataQuery>
         <dataStructure>
              <group name="G_Dept" source="Query1">
                   <element name="dep_name" value="name"/>
    </group>
    </dataStructure>
    </dataTemplate>

  • Can not select and delete a query in the screen designer

    I am getting mad with that problem...
    The problem is that I had a query(query1) based in another query(query2), both created in the query designer.
    I think some changes been made to query2 so query 1 was giving some erros. 
    I am trying to delete query 1, but it still appears in the data sources.
    And when I try to erase it from the screens, when I select the query visual studio closes...
    So please, how can I erase that query definitely?
    Thank you for your help!

    Hi promqueen,
    Thank you fro posting in MSDN forum.
    Since this forum is to discuss: visual studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer
    Documentation and Help System, and Visual Studio Editor. So I am afraid that this issue is out of support range of this forum.
    I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum.
    Thanks for your understanding.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Not able to Control the Data Control

    Hi, I have a bar chart which is bound to datacontrol through one iterator and one access iterator, and is placed on one splitter. Now on moving splitter and resizing the chart datacontrol re-fetches the data from the server. Why ? Cant it just re-size the chart without any connection with server. Also, i tried putting refreshCondition, and as it get calls two times everytime (one for JSF and another for ADF) and set refreshCondtion to false after second call. In that case i got no data. Also i tried refresh Ifneeded in both interators/accessIterator, still No Data. Is there any way i just execute data control only one time and henceforth can avoid its execution ?

    Hi Shay,
    PageDef Entries :
    <accessorIterator MasterBinding="Query1Iterator" Binds="Query" RangeSize="-1" DataControl="Query1" BeanClass="testing.test.datacontrol.definition.Query1.Query" id="QueryIterator" *RefreshCondition="#{pageFlowScope.myEditor.refreshNeeded}"* xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
    <iterator Binds="root" DataControl="Query1" id="Query1Iterator" RangeSize="-1" xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
    <graph IterBinding="Query1Iterator" id="Query6" xmlns="http://xmlns.oracle.com/adfm/dvt" type="BAR_VERT_CLUST" ChangeEventPolicy="none">
    This was the RefreshCondition i was talking about, but after putting this i am not getting any data. And removing this condition will invoke the datacontrol each time i move the splitter. I want to be it like when i order to refresh then only it should execute.
    Everytime execution till the server unnecessary makes my application very slow, and i want to be as faster than we see charts in other technologies.
    Any help would be appreciated.
    Thanks-
    Mangal

  • Confused about wheather to use session or some other technology

    i have two jsp pages one is index.jsp and other one is display.jsp,from index.jsp i am passing a string value and collecting it in display.jsp ,after collecting it i am making use of that value in a sql query to display the result from the data base,and i am getting one line (row) of display ,when i repeat the process again that row is over written which i do not want , what i want is as long as i keep sending strings from index.jsp tp disply.jsp the number of rows should be added (as a display in display.jsp)
    and i wanted to do that in jsp environment only as i am not aware of struts and some other technology.some sample code of display.jsp is as follows
    String INDENT_NUMBER = request.getParameter("indent_number");
    query1="select some data from some tables where a.INDENT_NUMBER = '"+INDENT_NUMBER+"'";
    while(rs.next){
    get some values here to display
    like
    String item_name =rs1.getString("item_name");
    String INDENT_QUANTITY=rs1.getString("INDENT_QUANTITY");
    here i want to display row wise data
    and now close the while loop
    please get me the idea if possible with sample code,i'll be greatfull to u,
    thanx

    I would add the String you get from the DB to an ArrayList, and store that ArrayList in the session. Then, at time of display, just iterate over the List. I would also look into putting the SQL into a JavaBean that does the work. Take as much of that code out of the JSP as possible.

  • IF Statement in Queries

    Can we use an "if then else" statemtent in a query such that it executes particular query depending on the condition specified on a UDF? That is,
    if condition = true, then execute query1 else if condition = false then execute query2.
    How do we write such a query in SAP B1  retrieve values depending on values selected in a formatted search?
    Kind Regards,
    Asif

    Hi,
    Try this:
    IF $\[Owtr.U_TrnTyp\] = '1'
    select T0.U_DocTyp FROM dbo.@DOCTYPES T0 where T0.U_TrnTyp = '1st Transfer'
    IF $\[Owtr.U_TrnTyp\] \<\> '1'
    select T0.U_DocTyp FROM dbo.@DOCTYPES T0 where T0.U_TrnTyp \<\> '1st Transfer'
    On your post the second select statement does not have a condition between T0.U_TrnTyp and '1st Transfer' so you may want to look at that part of the query.  I've added the not equal sign (it only displays if i add a \ before each symbol) as other wise the select statement looks the same.
    Regards,
    Adrian

  • How to do it?? in SELECT BOX

    here is the bean class sample code of getting the result set from
    database
    public void setMembers2()
    String query1="select e.idcode from employee e,wb_login w where e.idcode=w.idcode ";
    stmt1=conn1.createStatement();
    rs1=stmt1.executeQuery(query1);
    System.out.println("Executed query");
    if(rs1.next())
    do{
    id=rs1.getString(1);
    System.out.println("THE IDCODE IS JAVA "+id);
    setId_code(id);
    } while(rs1.next());
    else
    System.out.println("THE IDCODES ");
    here is the sample code in jsp i have to populate the Idcode's in SELECT BOX
    <select name="idcode" size="1" >
    <%
    String str1="";
    promotionbn.setMembers2();
    str1=promotionbn.getId_code();
    System.out.println("THE IDCODE IN JSP PAGE IS "+str1);
    %>
    <option value="<%=str1%>"> <%=str1%>
    </select>
    But in the select box priniting only one record.........

    Hey,
    Where are u defining the get/set methods method ??. The code u gave is not very clear. Acording to what u gave below it will surely print only one record probably the last one.
    KM
    here is the bean class sample code of getting the
    result set from
    database
    public void setMembers2()
    String query1="select e.idcode from employee
    e,wb_login w where e.idcode=w.idcode ";
    stmt1=conn1.createStatement();
    rs1=stmt1.executeQuery(query1);
    System.out.println("Executed query");
    if(rs1.next())
    do{
    id=rs1.getString(1);
    System.out.println("THE IDCODE IS JAVA
    CODE IS JAVA "+id);
    setId_code(id);
    } while(rs1.next());
    else
    System.out.println("THE IDCODES ");
    here is the sample code in jsp i have to populate the
    Idcode's in SELECT BOX
    <select name="idcode" size="1" >
    <%
    String str1="";
    promotionbn.setMembers2();
    str1=promotionbn.getId_code();
    System.out.println("THE IDCODE IN JSP PAGE IS
    "+str1);
    %>
    <option value="<%=str1%>"> <%=str1%>
    </select>
    But in the select box priniting only one
    record.........

  • A trouble with "LIKE" in a select statement

    Hi!
    I'm having trouble with "LIKE" in a select statement...
    With Access I can make the following and everything works well:
    SELECT name, birthday
    FROM client
    WHERE birthday LIKE '*/02/*';
    but if try to do it in my application (it uses Access), it doesn't work - I just can't understand that!!!
    In my application the "month" is always the currently month taken from the "System". Look what I'm doing...
    String query1 = "SELECT name, birthday " +
              "FROM client " +
              "WHERE birthday " +
              "LIKE '*/" +
              pMonth +
              "/*' " +
              "ORDER BY birthday ASC ";
    ResultSet rs = statement1.executeQuery(consulta1);
    boolean moreRecords = rs.next();
    The variable "moreRecords" is always "false", the query returns nothing although the table "client" has records that attend the query.
    Please, anyone can help me?! It's a little bit urgent.
    Thanks,
    Katia.

    Hi Katia,
    I'll bet the problem lies with the characters you're using to escape the LIKE clause. You're using the ones that Access likes to see, but that's not necessarily what's built into the JDBC-ODBC driver class.
    You can find out what the correct escape wildcard characters are from the java.sql.DatabaseMetaData.getSearchStringEscape() method. It'll tell you what to use in the LIKE clause.
    I'm not 100% sure about your code. It doesn't use query1 anywhere. I'd do this:
    String query = "SELECT name, birthday FROM client WHERE birthday LIKE ? ORDER BY birthday ASC";
    PreparedStatement statement = connection.createStatement(query);
    String escape = connection.getMetaData().getSearchStringEscape();
    String test = escape + '/' + pMonth + '/' + escape;
    statement.setString(1, test);
    ResultSet rs = statement.executeQuery();
    while (rs.hasNext())
    // load your data into a data structure to pass back.
    rs.close();
    statement.close();Let me know if that works. - MOD

  • Using if statement in cursor problem

    Hi, I am getting problem in cursor in plsql. i'e
        DECLARE
        CURSOR curRec IS
              if condition then
                   select query1;
              else
                   select query2;
              end if;
          c1rec curRec%ROWTYPE;
    Pls.. help.

    SQL Developer (Not for general SQL/PLSQL questions)
    Please mark this question as answered and post again in SQL and PL/SQL
    Regards
    Marcus

  • XML extractvalue and NULL result-Problem

    I've got a very strange problem: One select gets restults in my development-database, the same select in production retrieves NULL.
    The following sql-construct:
    SELECT (
      CASE
        WHEN personkey!=-1
        THEN
          ( SELECT extractvalue( v.xml, '/p:PersonData/p:TypedPostalAddress[@id="' ||<string> || '"]/p:PostalAddress/p:PostalCode', .....')
          FROM <tbl1>,<tbl2>
          WHERE tbl1.id=tbl2.id)
        ELSE
          ( SELECT 'no person' FROM dual )
      END ) adress,
    FROM <tbl3>
    WHERE <tbl3>.personkey!=-1
    When I use a view containing an outer join in the ELSE-Condition of the case I'm not getting a result in production, but I do in development (same data, same oracle-version, but other instance), but when I use a view without an outer join in the else-Condition, I'm getting results also in production. The column "personkey" is not nullable.
    Does anyone got an idea what could be wrong with this SQL?
    Thanks in advance for help!

    Additional Information:
    When resolving the CASE to a "union all" query, I am having the following result:
    query1 is working
    query2 is working
    joining both queries with union all => the result of the first query (with the extractvalue) is NULL, the second query is still working.

Maybe you are looking for