Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Search two tables and display results

Reply
Thread Tools

Search two tables and display results

 
 
JP SIngh
Guest
Posts: n/a
 
      01-18-2006
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.



 
Reply With Quote
 
 
 
 
John Blessing
Guest
Posts: n/a
 
      01-18-2006
"JP SIngh" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
 
paul@bullschmidt.com
Guest
Posts: n/a
 
      01-23-2006
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-se...iplefields.asp

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search Results & Folder column display CSharpner Windows 64bit 0 11-21-2009 11:28 PM
Help ASP Coder - Search form display results in gridview Mike M ASP .Net 0 11-16-2007 07:56 PM
Two dropdownlist and two tables... Paolo ASP .Net Web Controls 0 09-19-2006 04:42 PM
Newbie: How to display search results? JM ASP .Net 1 07-10-2006 10:48 AM
UPDATE : Help Required to Populate search results - Array Search Craig Keightley Javascript 10 06-29-2005 10:54 AM



Advertisments