简体   繁体   中英

Select Distinct with Where Clause

I am trying to get all active Matrix Managers in the ComboBox , but what I am getting is Active as well as Non-Active .

Could anyone help me to correct my query:

cmbTL.RowSourceType = "Table/Query"
cmbTL.RowSource     = "SELECT Distinct Matrix_Manager FROM EmpMasterTbl WHERE Status='Active'"

Note: I am using MS Access 2013 DAO.

I suspect that you want:

SELECT Matrix_Manager
FROM EmpMasterTbl
GROUP BY Matrix_Manager
HAVING MIN(Status) = "Active" AND MAX(Status) = "Active";

This will get managers that have only active status.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM