Jump to content

Help me!Help me ...!


haibec

Recommended Posts

Hi Guys!I have two table Member includes : ID , Name and Product includes ID,ProductID,Name,Price . Both table related by ID . Make stuation : with a Member only buy maximum are 3 product . I want query exact amount member have Product and Price >=500$

Link to comment
Share on other sites

I don't understand, could you rephrase that?
Example :User 1 buy three product : product1 have Price >=500$,product2 have Price >=500$,product3 have Price >=500$User 2 buy two product : product3 have Price >=500$,product4User 3 buy product5 have Price >=500$User 4 not buyI want select : How many member buy at least a Product have Price >=500$
Link to comment
Share on other sites

Try this:SELECT COUNT(DISTINCT(users.ID)) AS num FROM users, orders WHERE users.ID=orders.ID AND orders.ID>=500The field you will get back will be called "num", and should contain the number of users who have bought at least one product with a price at least 500.

Link to comment
Share on other sites

Try this:SELECT COUNT(DISTINCT(users.ID)) AS num FROM users, orders WHERE users.ID=orders.ID AND orders.ID>=500The field you will get back will be called "num", and should contain the number of users who have bought at least one product with a price at least 500.
Yeahhhhh!Thank you very much!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...