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 |
Yonkouturko
Yak Posting Veteran
59 Posts |
Posted - 2013-02-01 : 05:42:42
|
SELECT SUM(Table_NEWDR_Payment_History.Amount_Received) AS [Total Amount Received], Table_NEW_DR.ReferenceNumberFROM Table_NEW_DR INNER JOIN Table_NEWDR_Payment_History ON Table_NEW_DR.ReferenceNumber = Table_NEWDR_Payment_History.ReferenceNumber GROUP BY Table_NEW_DR.ReferenceNumber, Table_NEWDR_Payment_History.ReferenceNumberi have REFERENCENUMBER AS ID herenow i have records from 0000000001 to 0000000023but the records below didn't show ReferenceNumbers 0000000008,0000000009,0000000010,000000001150500 00000000011207500 0000000002580 0000000003500 00000000045500 00000000052600 000000000610000 0000000007NULL 00000000123920 00000000134560 000000001413000 00000000151000 000000001712860 0000000018200 0000000019NULL 0000000020NULL 0000000021NULL 0000000022250 0000000023what will i do to show the records0000000008,0000000009,0000000010,0000000011please help... |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-01 : 06:36:40
|
may be they dont have any payment history. in that case, make it likeSELECT SUM(Table_NEWDR_Payment_History.Amount_Received) AS [Total Amount Received], Table_NEW_DR.ReferenceNumberFROM Table_NEW_DR LEFT JOINTable_NEWDR_Payment_History ON Table_NEW_DR.ReferenceNumber = Table_NEWDR_Payment_History.ReferenceNumberGROUP BY Table_NEW_DR.ReferenceNumber, Table_NEWDR_Payment_History.ReferenceNumber ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
Yonkouturko
Yak Posting Veteran
59 Posts |
Posted - 2013-02-02 : 06:24:11
|
Ohh shucks... I've Tried LEft join earlier but it did not work... i wonder why...but your's works!!! THANK YOU SO MUCH MY FRIEND!!!! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-02 : 07:59:01
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|