Sorry, I won't use those abbreviations anymore. Also, thank you for giving my question your time.
I deeply apologize if I'm just being an idiot, but feel as though I must not be making myself clear on my goal because in order to do this the way I believe you're suggesting I WOULD have to do it dynamically (if I follow your suggestion of only using fields that the user actually chooses to search by to improve efficiency).
Just so we're on the same page and you understand what I'm after, please look at the advanced google search form here:
http://www.google.com/advanced_search?hl=en Notice that the user can input whatever fields they want (one, a few, many, all, it doesn't matter to in respect to what google is requiring of the user). So I have something similar where I have about a dozen fields and I don't want to restrict the user on which combinations of fields they use.
As far as I know, I have to provide the column names and the values can be dynamic using the IN parameters like: name=?, age=?, etc., but I can't do: ?=?, ?=?. I'm correct on this aren't I? This is from looking at several examples and having always done it this way myself. However, if I'm wrong and there's an easy way to do this that would be great.
So given my problem statement how would I deal with the multiple combinations of 'chosen' fields by the user without doing this dynamically? (You mentioned in your last reply that I
wouldn't need to do this dynamically so that's why I ask).
So for example with only three fields WITHOUT doing it dynamically I'm conceiving that I'd have to go through this mess:
So for 10 fields it's going to get ridiculous
unless I do it dynamically, or use my first idea of having one PreparedStatement and setting empty fields to '%' so I could just do:
col1=? AND col2=? AND col3=?.
However, I agree with you that this would not be the most efficient way, so I am quite keen to find another solution. I have already done a lot of dynamic building of sql so it doesn't bother me to do so if I have to but I'm just wondering if there's a better way before I commit to that solution. Thanks for your time and again I apologize again if I'm not getting what you're trying to convey to me, but I still don't quite have the answer I'm looking for and I'm going to start coding this tomorrow.