
March 17th, 2005, 01:02 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 34
Time spent in forums: 10 h 13 m 54 sec
Reputation Power: 6
|
|
|
SQL query WHERE question
(cross-posted b/c I'm using Oracle 9i and thought this forum might be of more help than the general database forum)
Hi,
I have a form which produces results that I'd like to search the db with then create another form for further search. My question is, if someone selects to search "all" from the first form, how do I indicate that within the following Select statement? Ie - what value would I give the optionselected so that it picks up all the rows in whichever field?
<code>
<%
//create statement object
Statement stmt = conn.createStatement();
//create resultset object
ResultSet rs = stmt.executeQuery("SELECT * FROM SCHEMA.TABLE where FIELD1 = ('" + optionselecteda + "') and FIELD2 = ('" + optionselectedb + "') and FIELD3 = ('" + optionselectedc + "') and FIELD4 = ('" + optionselectedd + "') ");
%>
</code>
Thank you so much for any help!
Kaihea
|