Reputation: 3
This code sorted list and output is 1, but i need to view the list
SELECT AVG(CustomerID)
FROM Customers
WHERE CustomerID = ( SELECT MIN(CustomerID) FROM Customers )
Upvotes: 0
Views: 37
Reputation: 46239
From your question you need to get AVG
and MIN
Value then Compare.
SELECT CustomerID
FROM Customers T
INNER JOIN
(
SELECT MIN(CustomerID) m, AVG(CustomerID) a
FROM Customers
) T2 ON T.CustomerID >=m AND T.CustomerID <= a
Upvotes: 1
Reputation: 1041
I dont understand why you are averaging customerid But still
select * from customers where customerid <
(SELECT avg(customerid) FROM Customers))
Upvotes: 0