Akhter HUssain

Akhter HUssain

  • 1.1k
  • 906
  • 25k

Two Foreign key in one table?

Feb 3 2020 11:49 PM
I want below output from CrossMatch Table where i am inserting two BID from Group table,one BID of Patient and Second BID of Donor
 
below is my data
 
  1. CREATE TABLE #Group(BID INT,BName VARCHAR(50))  
  2. CREATE TABLE #Patient(PID INT,PName VARCHAR(50),BID int)     
  3. CREATE TABLE #Donor(DID INT,DName VARCHAR(50),BID int)  
  4. CREATE TABLE #CrossMatch(CID INT,PID int,DID int,BID(Patient) int ,BID(Donor) int )     
  5.     
  6.      
  7. INSERT INTO #Group VALUES(1,'A')      
  8. INSERT INTO #Group VALUES(2,'B')      
  9. INSERT INTO #Patient VALUES(1,'Akhter','1')      
  10. INSERT INTO #Donor VALUES(1,'Hussain','2')     
  11. INsert into #CrossMatch Values(101,1,1,1,2)  
 

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (3)