l0ve2hat3 Posted July 16, 2008 Share Posted July 16, 2008 I need compare two tables. first table- [invoice] and contains a row named [total_price] and [invoice_Number] second table- [invoice_Itemized] contains [PricePer], [Qty] and [invoice_Number] here is a same of the [invoice] table column:[invoice_Number]-[Total_Price] value: 1 10.00 here is a same of the [invoice_itemized] table column: [invoice_Number]-[PricePer]-[Qty] value: 1 2.00 1 value: 1 2.00 1 value: 1 2.00 1 value: 1 2.00 1 value: 1 2.00 1 what i want to do is show the total of [invoice].[Total_Price] and the total of ([invoice_Itemized].[PricePer]*[invoice_Itemized].[Qty]) to compare I came up with SELECT SUM( [invoice].[Total_Price] ) as Total_Price,SUM( [invoice_Itemized].[PricePer]*[invoice_Itemized].[Qty] ) as Itemized_Price FROM [invoice] LEFT JOIN [invoice_Itemized] ON [invoice_Itemized].[invoice_Number]=[invoice].[invoice_Number] Link to comment https://forums.phpfreaks.com/topic/115051-help-building-sql-statement/ Share on other sites More sharing options...
l0ve2hat3 Posted July 16, 2008 Author Share Posted July 16, 2008 what i want to do is show the total of [invoice].[Total_Price] and the total of ([invoice_Itemized].[PricePer]*[invoice_Itemized].[Qty]) to compare EDIT*** what i want to do is show the total of [invoice].[Total_Price] and the total of ([invoice_Itemized].[PricePer]*[invoice_Itemized].[Qty]) to compare for each row in the [invoice] table Link to comment https://forums.phpfreaks.com/topic/115051-help-building-sql-statement/#findComment-591663 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.