New problem with join table

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Citizen99
Forum Commoner
Posts: 32
Joined: Wed Dec 24, 2003 6:52 am
Location: Where noone understand me...

New problem with join table

Post by Citizen99 »

I have 3 tables:
1) products: id_product, name, group, price, quantity, avilablity
2) user: login, pass, group
3) discount: id_product, group, rabate

Diffrent users has different discount on different product, I have a list for example:

1, table, group_a, 100$
2, chair, group_b, 50$

but I have 10% for products 'a' and 10% for products 'b' discount on that product so it should print

1, table, group_a, 90$
2, chair, group_b, 45$

other client have 20% for 'a' and 10% for 'b'... etc.

I dont know how to write query that can show table 'products' after rabate, different for each user depend who logs in. Maybe change in tables structure t make that problem easier?

Thx for help, sory for my english :]
Post Reply