Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
RajeS
Starting Member
2 Posts |
Posted - 2006-11-09 : 10:13:16
|
Hi, I have two tables like Table A and Table B. Table A has column like Pat_no, Prescrip.No,PrescriptionDate,Exp.DateTable B has Column like Pat_no,Prescrip.No,RefillDate,Exp.dateMy question is If Table A and Table B has same Prescrip.No then I have to find Max(RefillDate) depends on Pat_no and prescrip.NO ( Prescrip.No may repeat in Table B)AndIf TableA has Prescrip.No and Table B does not have that Prescrip.No, I have find PrescriptionDate from Table A.Could you please let me know, How can I do this.ThanksRaje |
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2006-11-09 : 10:23:19
|
Is this homework?STAR SCHEMAS ARE NOT DATA WAREHOUSES! |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-11-09 : 11:51:18
|
use INNER JOIN and max().Check out Books OnLine for the syntax. KH |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|