View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
AA2e72E AA2e72E is offline
external usenet poster
 
Posts: 400
Default SQL? Index? Excel?

"Robin Hammond" wrote:
SELECT EmployeeName FROM my_table WHERE Salary <=10,000 AND Salary <= 20,000;


Given that SQL is a description of the results sought, this is more
descriptive and quite likely faster:

SELECT EmployeeName FROM my_Table WHERE SALARY BETWEEN 10000 and 20000

How can I get only one HSBC and one Whavocia into Excel cell for a selection?


SELECT Top 1 EmployeeName FROM my_table WHERE Bank = 'Wachovia'
SELECT Top 1 EmployeeName FROM my_table WHERE Bank = 'HSBC'


This gives two recordset objects; if the intention is to pick the distinct
'Bank' (there are two, Wachovia and HSBC), this will return the result is a
single recordset & will cope with other distinct Bank names:

SELECT Distinct(EmployeeName) FROM my_table GROUP BY Bank;