Thread: Tech Whats this called?
View Single Post
Old 11-22-2022, 07:14 AM  
redwhiteandblue
Bollocks
 
redwhiteandblue's Avatar
 
Industry Role:
Join Date: Jun 2007
Location: Bollocks
Posts: 2,792
No it's not a union.

You need to decide the relationship between the two tables. If only one user can ever be the author of a document, you just need a column in the document table containing the user id of that user.

If more than one user can contribute to a document you need a relational table. This would be another table with two columns, one for the document id and another for the user id. You add a row in this table for each user who contributed to each document. This allows you to have as many relationships between users and documents as necessary.

You then pull out the data with two joins statements in your query.
redwhiteandblue is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote