hi
i need to do a select statement
there r 3 tables
1. Bills which contains records for all the bills generated for a consumer
2. Master which contains the master details of the consumer
3. Receipt details for the receipts which the consumer may have made for a particular bill (there r chances that the consumer may not have made payment for a particular bill)
i have created a select statement as under:
it is giving me an error as follows:Code:select Bills.CustNo, CM.Name, Bills.IssueDt, Bills.Qty, Bills.LastRead, Bills.PReadDate, Bills.Reading, Bills.Reading, Bills.OP_Bal, Bills.Op_Dpc, Bills.Assessment, Bills.Rent , sum(R.ReceiptAmt) as ReceiptAmt From Bills INNER JOIN Master CM ON Bills.CustNo = CM.CustNo LEFT OUTER JOIN Receipt R ON R.CustNo = Bills.CustNo AND r.IssueDate = Bills.IssueDt ORDER BY Bills.CustNo, Bills.IssueDt
can someone pls guide me as to what the prob is...now there could b instances where the receipt is not there for that particular custno. for that particular issuedt so that should show as 0Code:Msg 8120, Level 16, State 1, Line 6 Column 'Bills.CustNo' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
pls. guide
thankx Kuldev




Reply With Quote