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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to Find Total no of Product?

Author  Topic 

umapathy
Starting Member

24 Posts

Posted - 2007-04-13 : 12:22:08
Hai All

i have a one table namely Product,
the table values are like this

Empid Product Qty
------------------
q001 sandle 5
q002 sandle 5
q001 lux 10
q004 margo 5
.
.
.
.
.
.
q00n n 19

i want to find every day total no of products in each product,i have n(100000) number of Records in my table

please Help me. i t is very urgent


Regards
Umapathy

Umapathy

Kristen
Test

22859 Posts

Posted - 2007-04-13 : 12:23:58
You mean something like this?

SELECT Product, SUM(Qty) as TotalQty
FROM MyTable
GROUP BY Product

Kristen
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-13 : 12:25:13
Every day total? Do you have date field in your table?

Select DateCol, Product, Sum(Qty)
from Product
Group by Datecol, Product
order by 1,2


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-13 : 12:32:37
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -