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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-12-05 : 08:17:09
|
| Ana writes "Hi, Is the second LEFT JOIN valid? SELECT REC.INV_NBR ,REC.ORIG_INV_DATE ,MAX(REC.DW_UPD_DT) AS UPD_DT ,SUM(PAY.RECV_APPL_AMT) AS APPL_AMT ,SUM(ADJ.RECV_ADJ_AMT) AS ADJ_AMT FROM DW.VRECEIVABLE REC LEFT JOIN DW.VRECV_PAY PAY ON REC.INV_NBR = PAY.INV_NBR LEFT JOIN DW.VRECEIVABLE_ADJ ADJ ON REC.INV_NBR = ADJ.INV_NBR WHERE REC.INV_NBR > '1234567'Please let me know.Thanks" |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2005-12-05 : 08:53:01
|
| The joins look fine, but it needs a GROUP BY clause for the aggregates to be valid. Something likeGROUP BY REC.INV_NBR, REC.ORIG_INV_DATE |
 |
|
|
|
|
|