hoangthi Posted December 29, 2015 Share Posted December 29, 2015 Hello friends I got a problem with Mysql. I want to link ONE UID in table Account to MANY UID in table Chat I set UID as foreign key in table Chat and then, references to account (UID) I tried to use Navicat to make a relationship but not succeed What I want is UID in table Chat MUST be one of the UID in table Account This is images: UID in this table is NOT one of UID in table Account Longing for your helps! Quote Link to comment https://forums.phpfreaks.com/topic/300047-mysql-table-relationship-and-foreign-key/ Share on other sites More sharing options...
Muddy_Funster Posted December 29, 2015 Share Posted December 29, 2015 Is your storage engine set to InnoDB? For the commands to set it up yourself (run in navicat query window) see :here: Quote Link to comment https://forums.phpfreaks.com/topic/300047-mysql-table-relationship-and-foreign-key/#findComment-1528791 Share on other sites More sharing options...
Barand Posted December 29, 2015 Share Posted December 29, 2015 You can only create the foreign key constraint if all records in chat have a matching uid in account table. You first need to fix those that do not match. Quote Link to comment https://forums.phpfreaks.com/topic/300047-mysql-table-relationship-and-foreign-key/#findComment-1528792 Share on other sites More sharing options...
hoangthi Posted December 29, 2015 Author Share Posted December 29, 2015 Is your storage engine set to InnoDB? For the commands to set it up yourself (run in navicat query window) see :here: I am not sure, I'll check it out. I am using Mysql in Xampp Quote Link to comment https://forums.phpfreaks.com/topic/300047-mysql-table-relationship-and-foreign-key/#findComment-1528796 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.