If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Making a car-filter - An advanced query you'll never figure out :S

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-27-10, 12:13
skoTner skoTner is offline
Registered User
 
Join Date: Feb 2010
Posts: 5
Making a car-filter - An advanced query you'll never figure out :S

I'm creating a webshop where I want to show a set of products based on what car is selected, as an addition to the regular product groups.

I now have several tables:
product
group
car_make
car_model
car_filter
session_car_filter

The session_car_filter table have the following coloumns:
car_make, car_model, car_year and session_id

The car_filter table have:
car_make, car_model, from_year, to_year, product_id

The product table have:
product_id, group_id, universal

The group table have
group_id

Now I want to make my website set one or several rows in the session_car_filter which is all good. The filters in the session must match up with the car_filter table and based on that show the products that is ment for this car only. AND if the product has "universal=1" in the table it should show no matter what the filters says. So I want to show all products with universal=1 and the products that match up with the filters.

Don't know if I've explained it good enough, but I've tried playing with joins over and over, but can't seem to figure it out.

Any good ideas?
Reply With Quote
  #2 (permalink)  
Old 02-27-10, 13:33
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,085
Quote:
Originally Posted by skoTner View Post
Now I want to make my website set one or several rows in the session_car_filter which is all good.
huh? make your website set some rows which is all good???

Quote:
Originally Posted by skoTner View Post
Don't know if I've explained it good enough
sorry, nope

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On