How to use IF ELSE statement in one QUERY to MS ACCESS

System.out.println("Enter Final Exam: ");
int f = Integer.parseInt(input.readLine());
command.executeUpdate("UPDATE Students SET Final_Exam='"+f+"',Raw_score=(QT+MT+Final_Exam)/3 WHERE stud_name='"+stdID+"'");
command.executeUpdate("UPDATE Students SET Raw_score=(QT+MT+Final_Exam)/3 WHERE stud_ID='"+stdID+"'");
if (rsf==100)
command.executeUpdate("UPDATE Students SET Final_Grade=1.0 WHERE stud_ID='"+stdID+"'");
else if(rsf < 100 && rsf > 90)
command.executeUpdate("UPDATE Students SET Final_Grade=2.0 WHERE stud_ID='"+stdID+"'");
else
command.executeUpdate("UPDATE Students SET Final_Grade=5.0 WHERE stud_ID='"+stdID+"'");How can I shorten my code using a IF ELSE statement inside a single query or two? Or is it possible?
Edited by: ivatanako on Sep 28, 2007 11:55 PM

Sun has tutorial trail for JDBC, you might want to browse through that; you'll get more details and samples there than here. Here's the link to the section on PreparedStatement: http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
(Yes I know it's on JavaRanch but I think it applies everywhere)
----------------------------------------------------------------

Similar Messages

  • How to use an if statement in javascript code

    Hello,
    I have a batch processing script to search for text "employee signature" on each page in a multiple page file and to then list in the console any pages that do not have the "Employee Signature" text included.
    The script is not yet functional as an if statement needs to be included.
    Can anyone please advise how to use an if statement in javascript code?
    var numpages = this.numPages;
    for (var i=0; i < numpages; i++)
    search.query("Employee Signature", "ActiveDoc");
    console.println('Pages that do not include an employee signature: ' + this.pageNum +' ');
    Any assistance will be most appreciated.

    Thank you very much for your assistance try.
    I have modified the code as suggested and the page numbers are now listing correctly, thank you, but....................,
    The console  lists every page as having an "employee signature" when there are pages in the document that do not have an employee signature.
    The code (revised as follows) is not processing the "getPageNthWord part of the statement" in the console report?
    Can you please advise where the code needs reworking?
    var ckWords; // word pair to test
    var bFound = false; // logical status of found words
    // loop through pages
    for (var i = 0; i < this.numPages; i++ ) {
       bFound = false; // set found flag to false
       numWords = this.getPageNumWords(i); // number of words on page
       // loop through the words on page
       for (var j = 0; j < numWords; j++) {
          // get word pair to test
          ckWords = this.getPageNthWord(i, j) + ' ' + this.getPageNthWord(i, j + 1); // test words
          // check to see if word pair is 'Employee' string is present
          if ( ckWord == "Employee") {
             bFound = true; // indicate found logical value
             console.println('Pages that includes an employee signature: ' + (i + 1) +' ');
             break; // no need to further test for this page
          } // end Employee Signature
       } // end word loop
       // test to see if words not found
       if(bFound == false) {
             console.println('Pages that do include an employee signature: ' + (i + 1) +' ');
        } // end not found on page  
    } // end page loop
    Thank you

  • How to use the Include Statement in the BADI

    Dear All,
            I am trying to implement the BADI. So i need to use the Include in the BADI.
    How to use the Include statement in the BADI. I cant able to use it in the Public, Private and protected statement.
    Where should i mention that,,,,
    Thanks
    Yogesh

    Hi Sharat,
      Thanks for your reply.
    I need to use the BADI HRWPC_PCR_APPR_FORM. In which the values are available in the Container. So if i need to use the container values then i need to use that include <cntain>.
    Is there any possible ways to make it.
    Thanks
    Yogesh

  • IF-ELSE statement in BI  Query

    Hi guys i have a requirement where in i have condition as mention below...
    If  say X=0 then Y=0  and
        if    X>0  then y=1
      where X  is  key figure value...to be compared ..
    can any one suggest me the logic as to how i need to design this in the query..any option of using IF-ELSE statement...
    an in the result if  Y=0 then i should show as a * (star)..how can we do this in the query?
    can any one suggest me a solution for this please..
    Rgds
    Shilpa

    shipa,
    please check these links
    [Defining Exceptions|http://help.sap.com/SAPHELP_NW04S/helpdata/EN/43/21b4cd14cd06f4e10000000a422035/frameset.htm]
    [Defining and Changing Exceptions|http://help.sap.com/saphelp_nw04/helpdata/EN/c2/f6843b49f6a40de10000000a11402f/content.htm]

  • How can we use IF ELSE  statement in Header Section

    Hi All
    I have requirement to display a bill address in header section based on a particular status ,would some body please share that is it possible to use if else in header section .
    Thanks in advance
    Thanks
    Pratap

    you cannot place your if conditions within form fields in the Word header. But you can directly type the tags instead.
    Regards
    Nishka

  • How to use two seperate iPods with one iTunes. Different Music Preferences

    My Wife and I both have 80 Gig iPods. We like different Music. How can we both use the same Windows XP computer and have different music lists?

    See: How to use multiple iPods with one computer
    Forum Tip: Since you're new here, you've probably not discovered the Search feature available on every Discussions page, but next time, it might save you time (and everyone else from having to answer the same question multiple times) if you search a couple of ways for a topic, both in the relevant forums, in the User Tips Library and in the Apple Knowledge Base before you post a question.
    Regards.

  • How to use multiple WSDL operations in One BPEL process Recieve Activity ?

    Is there anyway to attach multiple WSDL operations with a Single BPEL process ? How ?

    Thanks Melvin for your quick respond.
    When I create a BPEL process, It asks me to give the XSD as an Input. When I import the XSD it asks me to select an operation not more than one. Let suppose I select addRequest and finish the wizard.
    Now what I can see, It create Recieve activity with an Input msg of Add operation. Well what I understand from your statement is that, I remove the recieve activity and put the Pick activity.
    Now my question is How to mention the other operations like update and delete ? And how to test them ?? The link provided by you is just tell me what Pick activity can do for me, But its not telling me how to use it ?? and how the give the operation to it. Where should I need to change in the BPEL ???

  • How to use Native SQL statement in JDBC receiver interface

    Dear All,
    Can any one please help us in using Native SQL statement in a JDBC receiver channel. The reason why I need to use Native SQL statement instead of standard XML structure is that I need to execute a dynamic SQL query in third party database system lke:-
    Select Field1 Field2 from TABLE Where Field3 like "%Name'
    I expect the the response in the form of XML file which I can pick up using synchornous interface as mentioned on help.sap.com:-
    http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    The value for %Name can change dynamically according to the transaction and hence cannot be inluded as a KEY element in standard XLM structure,
    Hence I need to know:-
    1. What message mapping I should use in case if I have to use Native SQL statement.
    2.What operation mapping I should use in case if I have to use Native SQL statement.
    If guess correclty I may have to use Java mapping to do the above activities. Hence I want to know
    3 .How do to go about it to do the Java mapping.
    Thanks
    Ameet

    >
    Ameet Deshpande wrote:
    > Dear All,
    >
    > Can any one please help us in using Native SQL statement in a JDBC receiver channel. The reason why I need to use Native SQL statement instead of standard XML structure is that I need to execute a dynamic SQL query in third party database system lke:-
    >
    > "
    > Select Field1 Field2 from TABLE Where Field3 like "%Name'
    > "
    > I expect the the response in the form of XML file which I can pick up using synchornous interface as mentioned on help.sap.com:-
    >
    > http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    > http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    >
    > The value for %Name can change dynamically according to the transaction and hence cannot be inluded as a KEY element in standard XLM structure,
    >
    > Hence I need to know:-
    >
    > 1. What message mapping I should use in case if I have to use Native SQL statement.
    > 2.What operation mapping I should use in case if I have to use Native SQL statement.
    > If guess correclty I may have to use Java mapping to do the above activities. Hence I want to know
    > 3 .How do to go about it to do the Java mapping.
    >
    > Thanks
    > Ameet
    You can use a stored procedure, and call it from jdbc receiver adapter.
    I also solve this issue, with a DBLookup in message mapping. You can refer to my blog, and this usefull 3d:
    http://simonlesflex.wordpress.com/2010/12/07/pi-oracle-dblookup/
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler

  • How to use a select statement with chinese characters?

    I am currently developing a java servlet<using tomcat 4.x> which allows me to use select statement to retrieve results from the Microsoft SQL Server 2000 database. I am using a simple form to get the parameter for querying. The main problem i'm facing is that there are chinese information in the SQL database, but i can't retrieve it through the sql statement with the chinese characters input<thru the form with the help of NJ STAR>in the WHERE condition. When i execute the statement, it returns me no results even though the rows are present in the database.
    Does anyone have the solution to using chinese words in the WHERE clause of the select statement to retrieve results with columns which contains chinese characters? Please help me. Thanks everyone. :)
    PS: when i cut and paste those characters in the sql database and paste onto java.. it is ??? in questionmarks.. but when i paste them into excel 2000.. its shown as chinese chars again..
    please heelppp~~

    Greetings,
    PS: when i cut and paste those characters in thesql
    database and paste onto java.. it is ??? in
    questionmarks.. but when i paste them into excelThis is why the SELECT is not returning any results.
    You need to set the character encoding set on your
    statement and parameters for the characters to be
    properly translated. Refer to the charsetName
    parameter in the String class constructor in your API
    docs and also to
    $JDK_DOCS/guide/intl/encoding.doc.html in your JDK
    documentation.
    2000.. its shown as chinese chars again..Because Office programs are performing the same kind
    of character translation with the appropriate MS APIs.
    please heelppp~~Regards,
    Tony "Vee Schade" Cookis it possible for you to show me some coding examples? i don't really understand what is to be done in order to set the char set and what does it really do.. tried reading up but still dun understand.. :(
    pardon my shallow knowledge of java..
    ok..
    The thing is when i used an insert statement with chinese characters of GBK format hardcoded into the java servlet and then i use the insert statement to insert the chars into the database, it cannot be seen as a chinese word when i off the NJStar. and then it can be searched out with my current form of servlet.. below is my coding of the servlet..
    note: i've set my html file to charset = GBK
    //prototype of Search engine...
    //workable for GBK input and output...
    import java.io.*;
    import java.io.OutputStream;
    import java.io.IOException;
    import javax.servlet.http.*;
    import javax.servlet.ServletException;
    import java.util.*;
    import java.sql.*;
    import java.nio.charset.Charset;
    public class SearchBeta extends HttpServlet {
         private Vector musicDetails = new Vector();
         private String query = "";
         public void service (HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException, UnsupportedEncodingException {
              query = req.getParameter ("T1");
              System.out.println("before:"+query);
              String type = req.getParameter ("D1");//type
              query = req.getParameter ("T1");
              //query = "������";
              System.out.println("after:"+query);
              getResults(type,query);
              System.out.println("locale = :"+req.getLocale());
              res.setContentType ("text/html;charset=GBK");
              PrintWriter out = res.getWriter();
              out.println("<html>");
              out.println("<head>");
              out.println("<body bgcolor = \"black\">");
              out.println("<font face = \"comic sans ms\" color=\"Cornsilk\">");
              if (query.length()==0)
                   out.println ("Please key in your search query.");
              else if (musicDetails.size()==0)
                   out.println ("Sorry, no results matching your search can be found.");
              else {
                   out.println("<center>");
                   out.println("<table cellspacing = \"50\">");
                   int i = 0;
                   //Display the details of the music
                   while (i<musicDetails.size()) {
                        Results details = (Results)musicDetails.get(i);
                        String dbArtist = "";
                        String dbAlbum = "";
                        String dbTitle = "";
                        String dbCompany = "";
                        dbAlbum = details.getAlbum();
                        dbTitle = details.getTitle();
                        dbCompany = details.getCompany();
                        dbArtist = details.getArtist();
                        try{
                             dbAlbum = new String(dbAlbum.getBytes("ISO-8859-1"),"GBK");
                             dbTitle = new String(dbTitle.getBytes("ISO-8859-1"),"GBK");
                             dbCompany = new String(dbCompany.getBytes("ISO-8859-1"),"GBK");
                             dbArtist = new String(dbArtist.getBytes("ISO-8859-1"),"GBK");//correct translation.
                        catch(UnsupportedEncodingException e){
                             System.out.print(e);
                             e.printStackTrace();
                        String dbImage_loc = details.getImage();
                        out.println("<tr>");
                             out.println("<td><table>");
                                  out.println("<img src=C:\\Program Files\\Apache Group\\Tomcat 4.1\\webapps\\examples\\ThumbNails\\"+dbImage_loc+">");
                             out.println("<tr>");
                                  out.println("<th><font color=\"violet\"> Artist: </font></th>");
                                  out.println("<td><font color=\"Cornsilk\">"+dbArtist+"</font></td>");
                             out.println("</tr>");
                             out.println("<tr>");
                                  out.println("<th><font color=\"violet\"> Title: </font></th>");
                                  out.println("<td><font color=\"Cornsilk\">"+dbTitle+"</font></td>");
                             out.println("</tr>");
                             out.println("<tr>");
                                  out.println("<th><font color=\"violet\"> Company: </font></th>");
                                  out.println("<td><font color=\"Cornsilk\">"+dbCompany+"</font></td>");
                             out.println("</tr>");
                             System.out.println("album: "+ dbAlbum);
                             out.println("<tr>");
                                  out.println("<th><font color=\"violet\"> Album: </font></th>");
                                  out.println("<td><font color=\"Cornsilk\">"+dbAlbum+"</font></td>");
                             out.println("</tr>");
                             System.out.println("company: "+ dbCompany);
                             out.println("</table></td>");
                        out.println("</tr>");
                        i++;
                   out.println("</table>");
                   out.println("</center>");
              out.println("</font>");
              out.println("</body>");
              out.println("</head>");
              out.println("</html>");
              out.close();
              //to remove all the elements from the Vector
              musicDetails.removeAllElements();
         //get Searched Music Details and store in Results object which is stored in musicDetails vector
         public void getResults (String type, String searchQuery) {
              try {
                   Class.forName ("com.microsoft.jdbc.sqlserver.SQLServerDriver");
                   Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=music","sa","kokkeng");
                   Statement stmt = con.createStatement();
                   String query = "SELECT * FROM MusicDetails WHERE "+type+" = '"+searchQuery+"'";
                   ResultSet rs = stmt.executeQuery(query);
                   while (rs.next()) {
                        String artist = rs.getString("Artist");
                        String title = rs.getString("Song");
                        String company = rs.getString("Company");
                        String album = rs.getString("Album");
                        String image_loc = rs.getString("Image");
                        Results details = new Results (artist,title,company,album,image_loc);
                        musicDetails.add(details);
                   stmt.close();
                   con.close();
              catch (Exception e) {
                   System.out.println(e.getMessage());
                   e.printStackTrace();
    with the above servlet i created, i can search out the data in the database which i've inserted through the insert statement. I still can't search for things i've keyed into the database directly using NJStar..
    thank you so much for helping.. really hope any one else who knows the answer to this will reply too... thank you all so much...
    -KK

  • How to use a case statement in where clause

    Hi All,
    I have a requirement which is to bring all the claims that are created in the last month.So, i wrote a query something like this
    select * from claims
    where
    (Month(ClaimOpenDate) = Month(Getdate())-1 and year(claimopendate) = year(getDate()))
    which would give me any new claims created in last month of current year, but this condition fails if we are in the first month of a new year( lets say if we are in 2016 jan then month(getdate())-1 would be 0 and year(getdate()) would be 2016 so we dont
    find any records where year is 2016 and month is 0 for claimopen).
    So, i would like to use a case statament or something which can help me get around this one.
    Can someone please help me with any suggestions?
    Thanks

    Hi Jason,
    Thanks a lot for your help. This is what exactly i am looking for but i just gave a sample query above below is my original query 
    select
    row_number() over (order by [ClaimNumber]) as DataElementName
    ,c.PolicyNumber as PolicyNum
    , c.FirstName as CustNameF
    ,c.LastName as CustNameL
    ,c.PolicyForm as PolType
    ,'Homesite' as Company
    ,[ClaimNumber] as ClaimNum
    ,E.office as Ofc
    ,e.Supervisior_FullName as Team
    , RIGHT(e.adjuster_Name ,LEN(e.adjuster_Name)- charindex(',' ,e.adjuster_Name)) as FORepF
    , case when charindex(',' ,e.adjuster_Name) <> 0 then left(e.adjuster_Name,charindex(',' ,e.adjuster_Name)-1) else e.adjuster_Name end as FORepL
    ,e.AdjusterID as RepC -- not sure
    ,CONVERT ( varchar,c.LossDate ,101) as DOL
    ,convert (varchar,c.ClaimOpenDate,101) as DOR
    ,rtrim(c.Loss_State) as LossSt
    ,c.Loss_ZipCode as LossZIP
    ,c.Loss_City as LossCity
    ,c.LossType as FOL
    ,'' as PR
    ,'' as PRNum
    ,1 as FeaNum
    ,'HO' as FeaType
    ,case when rtrim(c.claimStatus)= 'Closed' then 'Closed' else 'Open' end as FeaStat
    ,'' as FeaOpen
    ,'' as FeaClosed
    ,s.PaymentIndemnityAmount as PaidAmt
    ,s.ReserveIndemnityAmount as Reserve
    ,'' as Sub
    ,'' as Sal
    ,'' as FeatOwnOfc
    ,e.Supervisior_FullName as FeatOwnTeam
    ,RIGHT(e.adjuster_Name ,LEN(e.adjuster_Name)- charindex(',' ,e.adjuster_Name)) as FeatOwnRepF
    ,case when charindex(',' ,e.adjuster_Name) <> 0 then left(e.adjuster_Name,charindex(',' ,e.adjuster_Name)-1) else e.adjuster_Name end as FeatOwnRepL
    ,e.AdjusterID as FeatOwnRepCode
    ,NULL AS Description --not sure
    from [Stg].[HS_DW_RV_Claims] c
    inner join [dbo].[Claims_Primary_Adjuster] a on a.CLAIM_NUMBER = c.ClaimNumber
    inner join [dbo].[vw_Adjuster] e on e.adjuster_Name = a.primary_ADJUSTER
    left outer join [Stg].[HS_DW_LossClaimSummary] s on c.ClaimKey=s.ClaimKey
    where c.LoadSource = 'CMS'
    and
    (s.PaymentIndemnityAmount <>0 or s.PaymentExpenseAmount <>0)
    and
    ClaimOpenDate BETWEEN DATEADD(mm, DATEDIFF(mm, 0, CURRENT_TIMESTAMP) -1, 0) AND DATEADD(mm, DATEDIFF(mm, 0, CURRENT_TIMESTAMP), 0)
    UNION ALL
    select
    row_number() over (order by [ClaimNumber]) as DataElementName
    ,c.PolicyNumber as PolicyNum
    , c.FirstName as CustNameF
    ,c.LastName as CustNameL
    ,c.PolicyForm as PolType
    ,'Homesite' as Company
    ,[ClaimNumber] as ClaimNum
    ,E.office as Ofc
    ,e.Supervisior_FullName as Team
    , RIGHT(e.adjuster_Name ,LEN(e.adjuster_Name)- charindex(',' ,e.adjuster_Name)) as FORepF
    , case when charindex(',' ,e.adjuster_Name) <> 0 then left(e.adjuster_Name,charindex(',' ,e.adjuster_Name)-1) else e.adjuster_Name end as FORepL
    ,e.AdjusterID as RepC -- not sure
    ,CONVERT ( varchar,c.LossDate ,101) as DOL
    ,convert (varchar,c.ClaimOpenDate,101) as DOR
    ,rtrim(c.Loss_State) as LossSt
    ,c.Loss_ZipCode as LossZIP
    ,c.Loss_City as LossCity
    ,c.LossType as FOL
    ,'' as PR
    ,'' as PRNum
    ,1 as FeaNum
    ,'HO' as FeaType
    ,case when rtrim(c.claimStatus)= 'Closed' then 'Closed' else 'Open' end as FeaStat
    ,'' as FeaOpen
    ,'' as FeaClosed
    ,s.PaymentIndemnityAmount as PaidAmt
    ,s.ReserveIndemnityAmount as Reserve
    ,'' as Sub
    ,'' as Sal
    ,'' as FeatOwnOfc
    ,e.Supervisior_FullName as FeatOwnTeam
    ,RIGHT(e.adjuster_Name ,LEN(e.adjuster_Name)- charindex(',' ,e.adjuster_Name)) as FeatOwnRepF
    ,case when charindex(',' ,e.adjuster_Name) <> 0 then left(e.adjuster_Name,charindex(',' ,e.adjuster_Name)-1) else e.adjuster_Name end as FeatOwnRepL
    ,e.AdjusterID as FeatOwnRepCode
    ,DESCRIPTION --not sure
    from Stg.IG_Document D
    inner join [Stg].[HS_DW_RV_Claims] c on D.PARENTREF = C.ClaimNumber
    inner join [dbo].[Claims_Primary_Adjuster] a on a.CLAIM_NUMBER = c.ClaimNumber
    inner join [dbo].[vw_Adjuster] e on e.adjuster_Name = a.primary_ADJUSTER
    left outer join [Stg].[HS_DW_LossClaimSummary] s on c.ClaimKey=s.ClaimKey
    where c.LoadSource = 'CMS'
    and
    DESCRIPTION like '%Denial Letter%'
    and
    ClaimOpenDate BETWEEN DATEADD(mm, DATEDIFF(mm, 0, CURRENT_TIMESTAMP) -1, 0) AND DATEADD(mm, DATEDIFF(mm, 0, CURRENT_TIMESTAMP), 0)
    So if i use your logic in the end for both the where clauses its been more than 10 minutes and the query is still running however if i use my old method it doesnt even take a second. Looks like its affecting the execution plan. Any suggestions to get around
    this one please?
    Thanks

  • How to use two jdk versions in one system.

    Hi All,
    Am working for two projects, in one i have to use jdk1.4 and in the second i have to use jdk1.5, how can i have two jdk in one system, am using windows xp, in that if i create two accounts and install two jdk's will it accept? what is the solution for this.
    Thanks,
    vyrav.

    I have 1.3, 1.5, and 1.6 installed here. You can install them wherever you like, and use the %JAVA_HOME% system variable to point your tool(s) to the desired one that you wish to use.

  • How to use multiple visa read in one program

    hi
    i am working at Hameg HM8143 power supply i want to measure voltage and current simultaneiously and use the measured values for further calculations. for this i used two visa read blocks.
    >>>>>>the measured values are shown in the same visa read string however i want it to be shown sepetately,
    >>>>>>One of the VISA read block gives error. so i want to know how to use VISA read to get current and voltage simultaneously in seperate strings
    >>>>>>than how to convert strings to numbers  for using them for my calcultions.
    i am attaching screen shot as well
    Attachments:
    screenshot.JPG ‏164 KB

    you can not use a single serial to send 2 commands simultaniously?
    There is a single serial line so one command has to be before another.  This doesnt mena that you can not read from 2 seperate threads but will have to ensure that there is a locking mechanism to make sure that your queries are atomic.  In labview encapsulating all communications can be done with an action engine which will allow for concurrent execution with automatic blocking of your resource (serial device).
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • How to use multiple tables in developing one Graph in Endeca Integrator

    We have the requirement where we want to show the matrix for a particular entity which is coming from two separate table, there is a join which is possible on both the tables to get the correct data. But we are not able to find how to use data from two tables. We can create the SQL query with all the joining conditions but there are many tables which are involved so performance of query will be a problem. Is there any way in Endeca where I can create two data sources using two separate queries and while showing the matrix , I can join both the tables to get the matrix .

    You have not mentioned the version of Endeca that is used for your application. Joins are recently introduced in version 2.3 and could be used for avoiding complex DEFINE analytical statements. For this to work, the data should be present in the same dgraph and a single data source in Studio should point to data from both sources.
    These may not yet be the type of SQL joins that you may expect them to be as performing complex joins is also costly in Endeca. Hope you are not expecting to join huge data sets.
    The best possible solution I could think for addressing this problem is to load denormalized data (at least for now) into Endeca and do aggregations in queries. We can denormalize data in multiple ways even using ETL tools not just SQL queries as the above comment states.

  • How to use count sql statement?

    i've never used the count function and i'm not sure how to use it to print it onto a html page...my code is below...
    <%
    String tot = (String)session.getAttribute("total");
    int total = Integer.parseInt(tot);
    Class.forName("org.postgresql.Driver");
    // create connection url
    String URL2 = "jdbc:postgresql://dbhost/ug59sxn";
    // pass database parameters to JDBC driver
    Connection Conn2 = DriverManager.getConnection(URL2, "ug59sxn", "hupeswop");
    // query statement
    Statement SQLStatement2 = Conn2.createStatement();
    // generate query
    String Query2 = "SELECT COUNT(*) FROM userteam WHERE total > '"+total+"'";
    // get result code
    ResultSet SQLResult2 = SQLStatement2.executeQuery(Query2);
    int position = (int)SQLResult2 + 1;
    %>
    <TD valign=top>
    <P align=center><FONT size=+1>Welcome <%= session.getAttribute("fName") %> <%= session.getAttribute("surname") %><BR>
    Your Team, <%= session.getAttribute("teamname") %>, are currently lying in position <FONT color=red><% out.println(position) %></font>, with <FONT color=red><%= session.getAttribute("total") %></font> points.<BR>
    </FONT></P>
    <P align=justify>      Use the shorcuts on the left to visit different sections of the game.
    You can change your squad around to prepare for forthcoming games (fixtures can be found in the statistics section),
    transfer a player in to your squad to add some depth or replace injured members, or perhaps browse the statistics section to see how your team is doing in the FFL table.</P>
    <HR>
    <%
    SQLResult2.close();
    SQLStatement2.close();
    Conn2.close();
    %>
    i get the following errors:
    type Exception report
    message Internal Server Error
    description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
    An error occured between lines: 62 and 84 in the jsp file: /main2.jsp
    Generated servlet error:
    /home/students/ug/ug59sxn/servlets-local/work/localhost/myapp/main2$jsp.java:80: Invalid cast from java.sql.ResultSet to int.
    int position = (int)SQLResult2 + 1;
    ^
    An error occurred at line: 88 in the jsp file: /main2.jsp
    Generated servlet error:
    /home/students/ug/ug59sxn/servlets-local/work/localhost/myapp/main2$jsp.java:108: Invalid type expression.
    out.println(position)
    ^
    An error occurred at line: 88 in the jsp file: /main2.jsp
    Generated servlet error:
    /home/students/ug/ug59sxn/servlets-local/work/localhost/myapp/main2$jsp.java:111: Invalid declaration.
    out.write("</font>, with <FONT color=red>");
    ^
    3 errors, 1 warning
    if anyone can help me out, please do so..thanx in advance...

    You cannot cast a ResultSet object (or any other object for that matter) to a primitive (such as an int)
    Replace the following line of code:
    int position = (int)SQLResult2 + 1;with this:
    int position = 0;
    if(SQLResult2.next())
      position = SQLResult2.getInt(1) + 1;
    }Additionally I noticed that you have put single quotes around total in the following line:
    String Query2 = "SELECT COUNT(*) FROM userteam WHERE total > '"+total+"'";Are you sure that the total column in the userteam table is of string type? If not, you don't need the single quotes.

  • How to use the select statement in for loop

    Hi All,
    my question is can we use select statement in for loop like as follows .
    for key in select key from one_table.
    when i am using this am getting an error like Found select invalid i identifier
    how to make use of select statement in for loop
    please suggest me .
    Thanks
    Sree

    SQL>set serveroutput on;
    SQL> DECLARE
         BEGIN
         FOR Cur_Rec IN (SELECT dname FROM dept) LOOP
          DBMS_OUTPUT.PUT_LINE(Cur_Rec.dname);
         END LOOP;
         END;
    SQL>
    ACCOUNTING
    RESEARCH
    SALES
    OPERATIONSAs per your requirement always filter the Query beforehand
    Like
    FOR Cur_Rec IN (SELECT key FROM <table> WHERE key=1) LOOP
    END LOOP;Edited by: Lokanath Giri on १ दिसंबर, २०११ ३:५६ अपराह्न

Maybe you are looking for

  • HT1338 safari doesn't open properly

    Since I set up a new wifi (AT&T Uverse), I have been having difficulty opening Safari properly. If the home page opens, images are oten not available.  And when I search keyword on google, a list of results appear, but when I click one of those resul

  • Exception on JaxRpc invoke: HTTP transport error: javax.xml.soap.SOAPExcept

    Hi all, I am getting below error while invoking Siebel web service from BPEL service, <fault> -<remoteFault xmlns="http://schemas.oracle.com/bpel/extension"> -<part name="summary"> <summary> exception on JaxRpc invoke: HTTP transport error: javax.xml

  • Date Calculation in BEx

    Hello All, In my report, User wants to see a day counter which is the dfference of a date (date coming from cube) and Current date. For current date  we are using 0f_aday sap exit. How we can we acheive this, does it involve any User exits at the bac

  • Unsupported Version error when trying to run Web Services Tutorial example

    Hi there, I'm trying to run the first example from the Java Web Services Tutorial and get the following error when I type 'asant build' in my Command Window. Buildfile: build.xml BUILD FAILED java.lang.UnsupportedClassVersionError: com/sun/tools/ws/a

  • RH 6 - publish fail

    One of our authors is having issues publishing a project that they have published before with no problems.  Here is the error message they received: Publishing has been cancelled. Connection failed.  Please check the connection and post again. Native