get a list of record based only the specific values from table

akika

Registered User.
Local time
Today, 13:33
Joined
Aug 7, 2018
Messages
102
hi,
i have 2 tables..
tbl_sales fields (ID, Date, Empl_name, type, status, category, comments)
contains full list of all details that being sold per date.

tbl_specific_empl fields(ID, mainEmpl_name) contains only 5 specific employee name using it as list of values.

tables are independent..(attached data & tbls)

with this query getting error - at most one record to be returned by this subquery..

SELECT tbl_sales.[date], tbl_sales.[Empl_name], tbl_sales.[Type],
tbl_sales.[status], tbl_sales.[category], tbl_sales.[comments]
FROM [tbl_sales], tbl_specific_empl
WHERE tbl_sales.empl_name = (select mainEmpl_name from tbl_specific_empl where mainEmpl_name is not null);
;



how to do that i get a list of record based only the specific values in tbl_specific_empl. via query and any code to add to the button in a continuous form 'btn_specificempl'
 

Attachments

Last edited:
Try using IN instead of =.

Are you saving employee name or ID in tbl_Sales? Should be ID.
 
how to do that i get a list of record based only the specific values in tbl_specific_empl. via query and any code to add to the button in a continuous form 'btn_specificempl'

I don't understand what you are asking. I advise you demonstrate your issue with data.

You have posted some sample data. So, using that, tell me what data you expect your query to return.
 
@akika,

Why do you consider these tables to be independent?
 
i want the highlighted data to be displayed.
Will post a db sample
 
Use a join. There is no reason to use a sub-select.

SELECT tbl_sales.[date], tbl_sales.[Empl_name], tbl_sales.[Type],
tbl_sales.[status], tbl_sales.[category], tbl_sales.[comments]
FROM [tbl_sales] Inner Join tbl_specific_empl
ON tbl_sales.empl_name = tbl_specific_empl.mainempl_name;
 

Users who are viewing this thread

Back
Top Bottom