murfitUK Posted May 13, 2011 Share Posted May 13, 2011 This related to MYSQL (not SQL).I have a table with a field called HBRef. This value can be null but if a value is entered it must be unique. In mysqladmin I have set the field's default value to null and the attribute to unique. Now I cannot enter a new record with HBRef as null because such a value already exists.How do I set it up so that the field HBRef has a unique value unless it is null?Thanks. Link to comment Share on other sites More sharing options...
Skemcin Posted May 13, 2011 Share Posted May 13, 2011 You have to handle that melodramatically - although someone might know a little more about MySQL and therefore there could be away that I am not aware of to handle this strictly int he database (I'm not 100% sure). In code, though, you could write your insert/update queries several different ways to pull off the same end result. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.