rakete
rakete

Reputation: 3051

MySQL Relationship-problem

I have the following tables: - news - blogentries - pictures - comments

News, Blogentries and Pictures can be commented. I want to save all the comments in the comments-table.

My first idea was to make a referenceTo-column in the comments-table, but news, blogentries and picutres can have the same id.

Upvotes: 0

Views: 112

Answers (1)

Mark Byers
Mark Byers

Reputation: 838896

You can have a column which tells you the type of object - news, blog entry, or picture.

You might want to consider using the ENUM column type for this.

Upvotes: 1

Related Questions