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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 TSQL- Question

Author  Topic 

RajeS
Starting Member

2 Posts

Posted - 2006-11-09 : 10:15:29
Hi,

I have two tables like Table A and Table B.
Table A has column like Pat_no, Prescrip.No,PrescriptionDate,Exp.Date
Table B has Column like Pat_no,Prescrip.No,RefillDate,Exp.date

My 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)

And
If 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.

Thanks
Raje

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2006-11-09 : 10:22:06
Please do not cross-post:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=74695


STAR SCHEMAS ARE NOT DATA WAREHOUSES!
Go to Top of Page
   

- Advertisement -