Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a problem I have two columns in an table i must join on two diffrent tables on on each column of the first table


SQL
SELECT * from dbo.Sheet1$ s1
left join tblOrderDetails od  ON CAST(CAST(s1.DELIVERY_ID AS DECIMAL(20)) AS VARCHAR(20)) = od.ExtReference




this works fine to join on one table but i also have to join dbo.Sheet1$ on dbo.Sheet1$.model = workflow.model


please help me
Posted
Comments
Tejas Vaishnav 13-Feb-14 7:29am    
what is workflow???

1 solution

Just checkout it is working.. I hope you wi<ll use="" mode="hold">

SQL
SELECT * from mst_members  s1
left join mst_members_photo od  ON CAST(CAST(s1.its_ID AS DECIMAL(20)) AS VARCHAR(20)) = od.its_id



Join with 3 tables

SQL
select a.pt_id,a.pt_firstname + ' ' + a.pt_lastname as p_name, b.i_systolic, b.i_diastolic, c.i_pulse from patient_master a, nur_pressure b, nur_pulse c where a.pt_id =b.pt_id and a.pt_id =c.pt_id group by a.pt_id,a.pt_firstname + ' ' + a.pt_lastname, b.i_systolic, b.i_diastolic, c.i_pulse order by a.pt_id 
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900