Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ricom19
Starting Member
4 Posts |
Posted - 2007-06-16 : 07:17:06
|
| Hello guys,I am askng for any help ...am trying to get this SQL language.I want to provide an SQL query to set all the priority to 1 for all customers that have all their orders being for a product with importance of 100. --------------------------------------------------------------------There are three tables in the database: Customer, Product and Orders.The Customer table has three column: Customer_id (PK), priority, Address. The Orders table has three colums as well: Order_id (PK), Customer_id (FK), Product_id (FK)The Product table has three columns as well: Product_id(PK), Product_name, Importance.So the order table is connected to both the product and the customers table by respective foreign key. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-16 : 08:23:00
|
[code]update cset priority = 1from customer c inner join orders oon c.customer_id = o.customer_idinner join product pon o.product_id = p.product_idwhere importance = 100[/code] KH |
 |
|
|
ricom19
Starting Member
4 Posts |
Posted - 2007-06-16 : 08:51:01
|
| Thats was what i originally thought...thank you though. However, based on what i understand from SQL so far...that query would set priority 1 to all customers who has at least one order with a product with an importance of 100. What i want is a query that only sets priority 1 to customers who have all there orders being only products of importance of 100.please if am misunderstanding don't hesitate to point that out and then send me in the right direction. |
 |
|
|
|
|
|