Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I don't think testimonials would have enticed me to become a member, or even use the site for that matter. I use the site for a learning experience..."

Geography

Where in the world do Tek-Tips members come from?
shop73 (IS/IT--Management)
31 Oct 09 20:15
Hello,

can You help me build an advanced results page in Dreamweaver? I have three tables (products, categories and vendor). Table products has the fields: productID, productName, categoryID, vendorID. Table category has the fields: categoryID, categoryName. Table vendor has the fields: vendorID, vendorName. I put two parameters for search (categoryName and vendorName) on search.php page in two dinamic menu fields (menu category and menu vendor). On the Result Page I make recordset (rsResults) with SQL query:

CODE

SELECT products.productID, products.productName, categories.categoryName, vendors.vendorName
FROM products, categories, vendors
WHERE products.categoryID = categories.categoryID AND products.vendorID = vendors.vendorID

This SQL query returns all products. How to display only products that are given by search parameters?

Example1: category = monitor and vendor = Sony. How to show all products where is category monitor and vendor is Sony?

Example2: category = DVD-RW and vendor = Sony.

Thank you very much
traingamer (Programmer)
2 Nov 09 13:30
Maybe you should use an inner join instead of a cartesian join.
Something like (not tested)

CODE

SELECT products.productID, products.productName, categories.categoryName, vendors.vendorName
FROM products
  INNER JOIN categories ON
     products.categoryID = categories.categoryID
  INNER JOIN vendors
     ON products.vendorID = vendors.vendorID
WHERE categories.categoryName = "monitor"
   AND vendors.vendorName = "SONY"

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close