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
 General SQL Server Forums
 New to SQL Server Programming
 Taking value from not linked table in Left Join

Author  Topic 

hspatil31
Posting Yak Master

182 Posts

Posted - 2009-05-04 : 05:31:17
Dear All,

I tried following queary, in that i used left join.
In that queary i want add another table OCHP but this table not linked to any table (OINV and INV1). I want from OCHP table value ChapterId. How to take this value from table with using left join.
But third table(OCHP) not linked to another any table ?

'OCHP.ChapterId' This value also io want to show ?

select o.DocNum,o.DocDate,o.CardCode,
i1.ItemCode,i1.Dscription,i1.U_CL
from OINV o
left join INV1 i1 on i1.DocEntry = o.DocNum
where o.DocNum >= '94' and o.DocNum <= '94'

Harish Patil

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-05-04 : 05:36:59
Try this..

select o.DocNum,o.DocDate,o.CardCode,
i1.ItemCode,i1.Dscription,i1.U_CL,o1.ChapterId
from OINV o
left join INV1 i1 on i1.DocEntry = o.DocNum, OCHP o1
where o.DocNum >= '94' and o.DocNum <= '94' and o1.column= o.column


Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled
Go to Top of Page

hspatil31
Posting Yak Master

182 Posts

Posted - 2009-05-04 : 06:15:44
Thnks very much.
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-05-04 : 06:24:47
Welcome!


Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled
Go to Top of Page
   

- Advertisement -