For Programmers: Free Programming Magazines  


Home > Archive > ASP > January 2006 > Search two tables and display results









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Search two tables and display results
JP SIngh

2006-01-18, 6:56 pm

Hi All

A tricky issue wonder if someone can help

I have two tables like this

TapeRecords

TapeID - Integer Primary key
Title - Text

TapeDetails

RecordId (Primary Key)
TapeId (related to the taperecords table)
ProgramDetails (Text)

The tape details table has a record of the programs that are stored on each
tape and each tape we have about 20 programs.

What i want my users it to allow them to search by programdetails and
display the list of tapes that match that search. I am not able to built a
query to search and display at the same time. Can someone help?

I am okay with ASP programming so if anyone has any suggestions or sample
code i will be pleased to hear from you.



John Blessing

2006-01-18, 6:56 pm

"JP SIngh" <none@none.com> wrote in message
news:%237Ll7lDHGHA.4036@TK2MSFTNGP12.phx.gbl...
> Hi All
>
> A tricky issue wonder if someone can help
>
> I have two tables like this
>
> TapeRecords
>
> TapeID - Integer Primary key
> Title - Text
>
> TapeDetails
>
> RecordId (Primary Key)
> TapeId (related to the taperecords table)
> ProgramDetails (Text)
>
> The tape details table has a record of the programs that are stored on
> each tape and each tape we have about 20 programs.
>
> What i want my users it to allow them to search by programdetails and
> display the list of tapes that match that search. I am not able to built a
> query to search and display at the same time. Can someone help?
>
> I am okay with ASP programming so if anyone has any suggestions or sample
> code i will be pleased to hear from you.
>
>


This will search both the title and the description:

select taperecords.title
FROM taperecords, tapedetails
WHERE taperecords.tapeid= tapedetails.TapeId
AND
(taperecords.title LIKE '%searchstring%' OR tapedetails.ProgramDetails LIKE
'%searchstring%')

--
John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook, find/replace,
send newsletters


paul@bullschmidt.com

2006-01-23, 6:55 pm

Well I'd suggest creating one SQL statement containing both tables
using an INNER JOIN or LEFT JOIN.

And as far as criteria goes hopefully these can help:

Classic ASP Design Tips - Search Criteria on Multiple Fields
http://www.bullschmidt.com/devtip-searchcriteria.asp

Classic ASP Design Tips - Search For Keywords on Multiple Fields
http://www.bullschmidt.com/devtip-s...tiplefields.asp

Best regards,
-Paul
www.Bullschmidt.com - Freelance Web and Database Developer
www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com