Hello I tried to search from here but found no luck. I'd like to ask if would it be possible to have a multiple selected row be a condition inside a query?
I have table employeesT which has id, email, company_name and etc
So when selecting rows from this table from my page, there is another table down below which should show a joined table of employeesT and designationsT which should show id, email, designations etc.
Here is my query (email is used for the join)
SELECT et.id,
et.email,
dt.month,
dt.designation_status,
dt.team_size
FROM employeesT AS et
JOIN designationsT AS dt
ON dt.email = dt.email;
WHERE sa.email IS ({{{ employeesT.selectedRow.data }}})
I am not sure on what to put additionally on my SQL Query for a condition to only show those from my multiple selected rows. Please help.
EDIT - I was trying for my query like
SELECT et.id,
et.email,
dt.month,
dt.designation_status,
dt.team_size
FROM employeesT AS et
JOIN designationsT AS dt
ON dt.email = dt.email;
WHERE et.email IS ({{{ employeesT.selectedRow.data }}})
CodePudding user response:
What do you mean? Do you only want to select rows from employees if a record in the table designations exits?
SELECT et.id,
et.email,
dt.month,
dt.designation_status,
dt.team_size
FROM employeesT AS et
INNER JOIN designationsT AS dt
ON et.email = dt.email
WHERE et.id IN(1, 3, 4, 20)
or
SELECT et.id,
et.email,
dt.month,
dt.designation_status,
dt.team_size
FROM employeesT AS et
INNER JOIN designationsT AS dt
ON et.email = dt.email
WHERE et.email IN('[email protected]', '[email protected]', '[email protected]')
updated the query.