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 |
ramachandran.123
Starting Member
3 Posts |
Posted - 2012-11-29 : 05:42:30
|
Dear SirI am having a query select INVOICE.TarrifHeadNumber, SUM(INVOICEITEMS.ItemQuantity) From invoiceitems, invoice Where invoice.invoicenumber = invoiceitems.invoicenumber and month(InvoiceDate)='11' and year(InvoiceDate)= '2012' group by INVOICE.TarrifHeadNumber tarrifheadno SUM(INVOICEITEMS.ItemQuantity)84195030 9.0084198910 5.0084212190 223.0084569090 247.0084799040 1138.008481-80-1030 137.0085433000 6177.20tarrifheadno is uniquenow if i use below query and add invoicetypecode fieldselect INVOICE.TarrifHeadNumber,CETSH.GoodsDescription, SUM(INVOICEITEMS.ItemQuantity),INVOICE.invoicetypecode From invoiceitems, invoice , cetsh Where invoice.invoicenumber = invoiceitems.invoicenumber and month(InvoiceDate)='11' and year(InvoiceDate)= '2012' and cast(CETSH.CETSHNumber as varchar) = INVOICE.TarrifHeadNumber group by INVOICE.TarrifHeadNumber,CETSH.GoodsDescription,invoicetypecodeThis query return distinct of 11 records 84195030 841950309.00 184198910 841989105.00 284212190 84212190157.00 184212190 8421219042.00 284212190 8421219024.00 384569090 84569090189.00 184569090 8456909058.00 284799040 84799040166.00 184799040 84799040972.00 285433000 854330003764.00 185433000 854330002413.20 2Please help me to get same 7 recordsThanks and RegardsN.Ram |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2012-11-29 : 06:14:15
|
Remove invoicetypecode from your queryMadhivananFailing to plan is Planning to fail |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|