Reputation: 85
First table:
Second table:
In the first Table, there will be multiple given_to
with same taskid
, and specific to that taskid
i have set task
in 2nd table.
Is it possible to obtain the task of a same taskid
from multiple users to be printed in a table? If so How can we achieve it?
If possible, I also want to print the columns given_to
of the task seperated by space.
Please Help
Upvotes: 1
Views: 4094
Reputation: 3758
I'm not exactly sure I understood correctly what you want as a result, but as far as I get it you can achieve this with the correct SQL query, using a simple left join:
SELECT * FROM table1 LEFT JOIN table2 ON table1.taskid = table2.id
You might want to replace the SELECT * FROM ...
part with the specific fields you are interested in.
For more information about joins (that is: merging results/columns from several tables into one query result) take a look at the MySQL reference manual on JOIN syntax.
Upvotes: 2