I would like to update several database results in one row.
My Code:
sql_client = "SELECT pd.prj_id, pd.dl_id, pd.name, pd.email FROM projects_doc pd JOIN reminder rm ON pd.prj_id = rm.prj_id WHERE doc_typ = 'assignment' ORDER BY pd.id ASC;"
result = cursor.execute(sql_client)
result = cursor.fetchall()
for row in result:
sql_prj_id = row['prj_id']
sql_dl_id = row['dl_id']
sql_dl_name = row['name']
sql_dl_email = row['email']
Example Output:
- 1, 544, TestName1, [email protected]
- 2, 255, TestName4, [email protected]
- 2, 256, TestName5, [email protected]
- 2, 257, TestName6, [email protected]
- 3, 188, TestName7, [email protected]
How can I update my table so that the following result comes to an end?
Table structure
prj_id, dl_id, dl_name, dl_email
End result (example)
- 1; 544; TestName1; [email protected]
- 2; 255, 256, 258; TestName4, TestName5, TestName6; [email protected], [email protected], [email protected]
- 3; 188; TestName7; [email protected]