문제

I have a table of users, students and teachers. For example I want to create a new student and assign him a user account from the list. This works for me, but it is possible to assign the same user account to more students. How to fix this? Thank you.

도움이 되었습니까?

해결책

you should add unique index in students table, user_id field, this not allow to repeat, the same user_id, in students table.

http://dev.mysql.com/doc/refman/5.0/es/create-index.html.

You should use, "UNIQUE".

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top