Mohan Chandra

Mohan Chandra

  • NA
  • 101
  • 16.9k

How I can give foreign key on multiple columns

Jul 11 2016 7:32 AM
Hi,I need help,I am just learning this time
I have a table Invoice
which has fields
InvoiceNo
Invoice_amount
Invoice_Date
Exchange_Rate

and second table is Receipt
which has fields
ReceiptNo
ReceiptAmount
Receipt_Date
InvoiceNo
InvoiceDate
Exchange_Rate

Now What I need to do, here suppose i created a Invoice table
create table Invoice ( InvoiceNo varchar(15) not null, InvoiceAmount money not null, invoiceDate date not null, ExchangeRate Money not null, constraint pk_invoice primary key(InvoiceNo), constraint uk_inv unique (InvoiceNo, InvoiceAmount) )
I am just trying to create two tables Invoice and Receipt
I have created Invoice table but On receipt table I need references on
InvoiceNo, InvoiceDate so how I can give references when we need to give references on multiple columns.

please help me
i need help for how I can give foreign key references on multiple column 

Answers (7)