I have the following query:
SELECT id, subject, date
FROM mail
WHERE date > some_date
I need to cross reference the id returned by the above query with another table to get the user's username. How can I do it in one query?
Right now I am doing this:
foreach (id in result)
{
query = String.Format("SELECT username from USERS where id = {0}", id);
}
Expected column output:
id subject date username
--------------------------------