[thelist] search multiple tables in sqlserver
Andrew Martin
unopimento at hotmail.com
Thu Oct 3 18:01:01 CDT 2002
Using SQL Server 2000, I'm trying to search 3 different tables and 2 columns
within each table for specific words. I guess this SQL statement works but
I'm having difficulty processing the return:
sqlquery = "SELECT" & _
" n.my_id," & _
" n.my_body," & _
" r.their_id," & _
" r.their_body," & _
" o.our_id," & _
" o.opinion_body" & _
" FROM " & _
" my_stuff n with(NOLOCK)," & _
" their_stuff r with(NOLOCK)," & _
" our_stuff o with(NOLOCK)" & _
" WHERE " & _
" n.my_id = r.their_id AND" & _
" r.their_id = o.our_id AND" & _
" o.our_body like '%" & sqlSearchBox & "%' or" & _
" n.my_body like '%" & Sqlsearchbox & "%' or" & _
" r.their_body like '%" & Sqlsearchbox & "%' or" & _
" o.our_id like '%" & sqlSearchBox & "%' or" & _
" n.my_id like '%" & Sqlsearchbox & "%' or" & _
" r.their_id like '%" & Sqlsearchbox & "%'"
The ASP I'm using is:
Do Until rsBlah.EOF
Response.Write "id: " & rsBlah(0)
Response.Write "body: " & rsBlah(1)
Loop
What's going on?
Thanks!
More information about the thelist
mailing list