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 : 01:47:28
|
Dear SirI am having queryselect distinct(cetshnumber), INVOICEITEMS.ItemQuantity 'Quantity Manufactured',INVOICEITEMS.ItemQuantity 'Quantity Cleared'from INVOICEITEMS,invoice,cetsh where invoice.invoicenumber=invoiceitems.invoicenumber andmonth(InvoiceDate)=11 and year(InvoiceDate)=2012 group by cetshnumber,INVOICEITEMS.ItemQuantity I have given distinct but still the cetshnumber value is repeated for each record. Thanks and RegardsN.Ram |
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2012-11-29 : 01:54:55
|
looks like cetshnumber has multiple entries in other tables your are joining. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2012-11-29 : 02:46:41
|
Note that distinct wont work that way. It is applied to entire column set and not on cetshnumber only. If there are m,ultiple ItemQuantity associated to each cetshnumber , the cetshnumber will get repeated. You may need to remove ItemQuantity in GROUP BY cluae and use min or max on itMadhivananFailing to plan is Planning to fail |
|
|
|
|
|