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 |
|
sonytr
Starting Member
10 Posts |
Posted - 2007-12-12 : 15:41:39
|
| How to use two left outer join in a single query?I was trying to run the follwoing query.It is giving me error"select woancestor.wonum,wplabor.laborcode, wplabor.quantity,wplabor.laborhrs from wplabor,workorder left outer join woancestor on workorder.wonum=woancestor.wonumand wplabor left outer join labtrans on wplabor.laborcode=labtrans.laborcode where woancestor.ancestor='572099' and workorder.istask=1and workorder.wonum=wplabor.wonum"Error is "Server: Msg 156, Level 15, State 1, Line 3Incorrect syntax near the keyword 'left'."But the following query works fine "select woancestor.wonum,wplabor.laborcode, wplabor.quantity,wplabor.laborhrs from wplabor,workorder left outer join woancestor on workorder.wonum=woancestor.wonum where woancestor.ancestor='572099' and workorder.istask=1and workorder.wonum=wplabor.wonum"please help me |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-12-12 : 15:44:00
|
| select woancestor.wonum,wplabor.laborcode,wplabor.quantity,wplabor.laborhrsfrom wplaborinner join workorder on workorder.wonum=wplabor.wonumleft outer join woancestor on workorder.wonum=woancestor.wonumleft outer join labtrans on wplabor.laborcode=labtrans.laborcodewhere woancestor.ancestor='572099' and workorder.istask=1Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
sonytr
Starting Member
10 Posts |
Posted - 2007-12-12 : 15:50:14
|
| Thanks you.its working |
 |
|
|
|
|
|
|
|