hi
i have a big problem, i have a table where a datadset is clearly identified by three fields
(project no, customer no and contract date).
Now how do i tell my sql database that it is not allowed to put a exact second one with these same three fields in it. Should i make all three fields unique. Because now everyone can put in the same dataset multible times.
And if i make a select everything is <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> up.
avoid multible similar datasets
Moderator: General Moderators
You misunderstood what feyd said The combination of all three columns is defined to be unique. Have a look at this pagejoecrack wrote:no that doesnt work, because it has to be allowed to double the customer no for example.
there can be many projects from the same customer but not i combination witjh the same date and project no/.
http://dev.mysql.com/doc/refman/4.1/en/ ... index.html
where it talks about multiple column indexes
A column list of the form (col1,col2,...) creates a multiple-column index. Index values are formed by concatenating the values of the given columns.
You'd still need your application to be aware of unique rows as well, unless you just want standard mysql error messages
easy solution, just select count(*) where `row` = '' and `row2`= '' and `row3` = ''
if there exists a row with your conditions tell the user they already have a project or whatever
easy solution, just select count(*) where `row` = '' and `row2`= '' and `row3` = ''
if there exists a row with your conditions tell the user they already have a project or whatever