Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
i am using tables customer(Customerid) and project(Projectid)

my req is one project should have only one customer...

i.e, if project1 is assigned to customer1 then it should not be assigned again...but project1 can be assigned to customer2,3,4....

project contains(projectid,projectcode,projectdesc,projname)...projid is primary key
customer contains(custid,custname,custtype)...custid is primarykey...
Posted
Updated 24-Jul-12 20:11pm
v2
Comments
bbirajdar 25-Jul-12 2:05am    
ok..
graciax8 25-Jul-12 2:06am    
show us the table's columns.
Sergey Alexandrovich Kryukov 25-Jul-12 2:07am    
Not clear. First of all, what do you call a "project"?
--SA
Member 9068558 25-Jul-12 2:09am    
project contains(projectid,projectcode,projectdesc,projname)...projid is primary key
customer contains(custid,custname,custtype)...custid is primarykey...
Aarti Meswania 25-Jul-12 2:19am    
i.e, if project1 is assigned to customer1 then it should not be assigned again...but project1 can be assigned to customer2,3,4....

what is the meaning of line?
It's confusing!

1 solution

Personally? I would have a customer field in the project table. If it is null, it isn't assigned, if it is not null it is assigned to that customer. Since you can't put two values in the same field of the same row, you can't assign the project to more than one customer...
 
Share this answer
 
Comments
Member 9068558 25-Jul-12 2:21am    
not understood clearly
OriginalGriff 25-Jul-12 2:24am    
Add a column to your Project table: custid
When you assign a project to the customer, set the custid field of the project table to the id of the customer from the customer table.
Member 9068558 25-Jul-12 2:23am    
i dnt have customer field in project table
OriginalGriff 25-Jul-12 2:24am    
Add one!
sandeep nagabhairava 25-Jul-12 7:46am    
yes,your right... my 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900