View Single Post
  #1 (permalink)  
Old January 11th, 2008, 09:12 AM
kumiko kumiko is offline
Authorized User
Join Date: Aug 2006
Location: , , .
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default help with this searching sql condition problems

halo there....i cant solve the problem and it is quite urgent. i hope u can give me a hand.
i need to do a search. but this search is quite complicated for me since i m newbie here. i m using ms sql with asp script. from my interface, there is one text box for user insert keywords search, and two checkbox for users to check wan search by photographer name or lightbox. by default, it will search the keywords with the photoname and also the photokeywords. when user check the photographer checkbox, it will also search the photographer keywords at the same time; if user check the ligthbox, it will search the photoname, photokeywords and also the lightbox keywords, see if got the lightbox match, then check inside the lightbox got any photo, if got, get the result. if user check both then will search both of the condition. my output will be the photoname, photohrapher name, if the photo is inside the lightbox, then will display the lightbox name also. i duno how to do a good searching that can reduce the searching speed in Db. plz help...
below is my table design. i hope u can help me..thank you.

tbl_photo (photoid, photoname,photokeywords)
tbl_lightbox (lightboxid,lightboxname, lightboxkeywords)
tbl_lightboxphoto(lightboxphotoid,lightboxid,photo id)
p/s : the photokeywors, lightboxkeywords are store in this way --> apple orange pear grapes (with a space between the words)