views:

25

answers:

1

Hi My friend ask me these two questions and make my mind busy would you please help me that is there any different between these two questions or they are the same as each other? thanks

Consider that we have one table "Orders"

Orders table

OrderID  CustomerID  EmployeeID  Freight
1          VINET       5          32.31
2          Nima        3          13.31
3          VINET       6          14.03
4          Mina        4          19.01
5          Nima        4          14.52
.           .          .            .
.           .          .            .
.           .          .            .

those two questions:

1) Select the id of those customers that their Freight is more than average
2)Select  the name of those customers that their freight is more than average 

please tell me that what is the difference between these two questions? also the customer ID is the name of customers (this field is unique in the Customer table but not for Orders table)

+1  A: 

You have a CustomerId (char) and an EmployeeId (int). No CustomerName.

They appear not to be directly related so:

Yes, they are different (groups of records) and their SUM(Freight) will be different.

Henk Holterman
you mean for the first query I should return OrderID and for the second one returning the CustomerID?
What I acttuall1y meant is that your question is inconsistent with the example table. And OrderId does not play a role (when you want to sum the Freight).
Henk Holterman
really I can not get what you mean! please write your queries for each of these questions.please
matin, the problem is that we do not know what you mean. Read and correct your question.
Henk Holterman