Run dynamic query based on selection in dropdown to populate a table

Hi.

I would like to create a page where there is a dropdown widget (call it wLN) linked to a query
(for simplicity sake SELECT distinct(lastname) FROM names; )

Then on selecting a name from the dropdown widget populate a table widget (wTD) on the same page based on that selection and have it run the query.

Table query would be something like
SELECT firstname,lastname,email FROM people WHERE lastname = ‘{{wLN.selection.value}}’;

Maybe the table could have a JS filter, table only runs query on a trigger ?

Sorry. Just a newbie. Examples if possible.
Steve

I think that’s pretty similar to my question (and solution) here ?