Tuesday, 17 September 2013

SQL JOIN in 2 tables values and get many values from one column

SQL JOIN in 2 tables values and get many values from one column

I Have two tables as follows:
Antibiotics Patient
id Name id Name AntibioticA AntibioticB AntibioticC
1 A 1 John 1 2 3
2 b 2 Jim 4 2 1
3 c
4 d
I have the following question: What query I must use in order to take a
result like the one below:
John A B C (in case id=1)
Jim D B A (in case id=2)
My main problem is that I cannot search many values in the same column.I
used JOIN command but it allows me to join only one value of Antibiotics
so I take only the first one.

No comments:

Post a Comment