Hi,
 
About splitting the result in smaller pieces, i have resolved like this (not the best
way):
 
 I had two variables (hidden fields)  from and to and every time i have executed the query
ignored the part  1 - from ,  i have sent it back the part between from-to,
and again ignored the part of to-end.
Also watched for having both Previous, Next buttons or just Previous or Next.
This solution is not the best but it is working and if U are interseted i can send U some
code.
About the Sql guery i didn't undertand it. Do U have OR beetwen conditions ? 
Why not try like this:
String query="SELECT * FROM mytable WHERE ";
boolean thefirstcondition=true;
if( !  req.getParameterValues("param1")[0].equals("")  )
                                          if(thefirstcondition)
                                                  {
                                                  query=query +" param1="+req.getParameterValues("param1")[0];
                                                  thefirstcondition=false;
                                                  }
                                              else query=query +" OR param1="+req.getParameterValues("param1")[0];
  ....
repeat it 8 times
....
 
//execute the query                                          
 
p.s. Maybe all this doesn't have any sense taking in conideration the word OPTIMUM
 
If the query is complicated than that be more specific.
 
Best wishes,
                        Andras  
 
 
 
-----Original Message-----
From: Jeetandra Mahtani <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, May 18, 1999 11:53 PM
Subject: complicated sql...need some help...

>Hello,
>I am working on an inquiry form and I am kind of stuck in thinking of
>an optimum way to write the sql to do the inquiry. The form consists
>of 8 fields and the user needs to fill out atleast one field. A
>servlet will take the values entered(atleast one) by the user and
>search a table based on the values entered by the user.
>Now, there can be so many combinations since the user may enter one
>field or two ..etc.Any suggestions on how I could write the sql?
>Also, the sql may return a thousand records..how do I display about 50
>records per page. If the user clicks on a next button, the next 50
>records are displayed. Any idea on how I could split the retrieved
>records into pages.Thanks,JGM
>_____________________________________________________________
>Do You Yahoo!?
>Free instant messaging and more at http://messenger.yahoo.com
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to