
November 7th, 2000, 03:11 AM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
<i><b>Originally posted by : iyyappan n iyer (iyyappan_n_i@hotmail.com)</b></i><br /><br /><br /><br />------------<br />Guenter Podgornik at 9/21/2000 1:52:55 PM<br /><br /><br />I have an access database with two tables (author [AuthorID,FirstName, SecondName, Birth, Biography], books [AuthorID, Title, Synopsis, Characters, Appreciation]) that are linked by the key "authorID".<br /><br />I've linked the database to my website. There is the option to search for FirstName, SecondName and Title. I have no problem to figure out the SQL command (for the command object) for finding the results if only one of the three boxes are used. But I don't know how to write a query so that a user my fill in letters in two or all three boxes and then you get the inner join of the two resp. all three.<br /><br />BTW, queries should not be process if less than three letters are filled in.<br /><br />'****firstname search<br /><br />if not isempty(request.querystring("firstname") and isempty(request.querystring("secondname") and isempty(request.querystring("title") then<br />'search on firstname only<br />end if<br /><br />'second name only<br />if isempty(request.querystring("firstname") and not isempty(request.querystring("secondname") and isempty(request.querystring("title") then<br />'search on second only<br />end if<br /><br />'title only<br />if isempty(request.querystring("firstname") and isempty(request.querystring("secondname") and not isempty(request.querystring("title") then<br />'search on title only<br />end if<br /><br />'first and second name<br />if not isempty(request.querystring("firstname") and not isempty(request.querystring("secondname") and isempty(request.querystring("title") then<br />'search on firstname and second name only<br />end if<br /><br />'firstname,secondname and title search<br />if not isempty(request.querystring("firstname") and not isempty(request.querystring("secondname") and not isempty(request.querystring("title") then<br /><br />'search on all 3 fields<br />end if<br /><br />'similarly for other combinations like, first and title,sedond title<br /><br />'*********there are even more complex ways of doing this using string joins , try the above, fir the time being
|