Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / March 2008

Tip: Looking for answers? Try searching our database.

select distinct

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PsyberFox - 07 Mar 2008 09:23 GMT
Hi there,

I want to select Date and sum(Quantity) by date from a set of records
containing Date, Quantity and RouteCardNo

My view as follows:
select    distinct [Date], RouteCardNo, sum(A.Quantity) QtyA
from    Prod_Assembly_Data_1 A
group by A.[Date], RouteCardNo

BUT, I just want to show the sum(quantity) by date from unique RouteCardNo
numbers, i.e. I don't want the RouteCardNo to be part of the selection and
only want the result set to contain single date records with the specific
dates' quantity.

Please help! Thank you!
Roy Harvey (SQL Server MVP) - 07 Mar 2008 13:06 GMT
>Hi there,
>
[quoted text clipped - 12 lines]
>
>Please help! Thank you!

See if this is what you want.

SELECT [date], sum(A.Quantity) as QtyA
 FROM Prod_Assembly_Data_1
GROUP BY [date]

Roy Harvey
Beacon Falls, CT
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.