Posted - 01/31/2014 : 00:29:41
| Hello all,
I am using sql server management studio 2012. Please tae a minute or two to understand this problem, It's really important:(
The scenario is :
I have three table, Patient, patientAccount and Message.
Now, I am inserting values into tables Patient and Message first, and then after some time I am inserting values into PatientAccount Table.Now, the problem is in the software i am using sql with) i had this query:
select * from Patient join Message on Patient.GUID = Message.PatientGUID where Message.GUID = "..Data
and if I add PatientAccount in this query as well, like
select * from Patient join Message on Patient.GUID = Message.PatientGUID, PatientAccount where Message.GUID = "..Data
It becomes mandatory to add values to the PatientAccount table at the same moment when I am adding them to Patient and Message table, but what I really want is values to be taken up by query if there is data in the PatientAccount table, and if there is no values inserted into patientAccount table, It should pick up values from Patient and Message table only.
and I want all of it in one query.
Please please please help :(