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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 sql help

Author  Topic 

rum23
Yak Posting Veteran

77 Posts

Posted - 2008-12-04 : 20:08:07

Please help.....

The "AmountPaidTillNow" is not appearing when I execute the following sql. Why is that? It instead comes up as "No column name"

SELECT (POProject.Cost) TotalAmount,
(SELECT (ISNULL(SUM(Invoice.PaidAmount),0)) AmountPaidTillNow FROM INVOICE WHERE Invoice.InvoiceStatusId = '2')
FROM POProject, PurchaseOrder, Invoice
WHERE PurchaseOrder.PONumber ='PO0000001'
AND PurchaseOrder.PurchaseOrderId = POProject.PurchaseOrderId
AND Invoice.PurchaseOrderId = PurchaseOrder.PurchaseOrderId
Group by Cost, PaidAmount

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-12-04 : 20:10:00
quote:
Originally posted by rum23


Please help.....

The "AmountPaidTillNow" is not appearing when I execute the following sql. Why is that? It instead comes up as "No column name"

SELECT (POProject.Cost) TotalAmount,
(SELECT (ISNULL(SUM(Invoice.PaidAmount),0)) AmountPaidTillNow FROM INVOICE WHERE Invoice.InvoiceStatusId = '2')as AmountPaidTillNow
FROM POProject, PurchaseOrder, Invoice
WHERE PurchaseOrder.PONumber ='PO0000001'
AND PurchaseOrder.PurchaseOrderId = POProject.PurchaseOrderId
AND Invoice.PurchaseOrderId = PurchaseOrder.PurchaseOrderId
Group by Cost, PaidAmount

Go to Top of Page

rum23
Yak Posting Veteran

77 Posts

Posted - 2008-12-04 : 20:13:15

Perfect! thanks
Go to Top of Page
   

- Advertisement -