SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select statement with count
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Vack
Constraint Violating Yak Guru

USA
484 Posts

Posted - 01/07/2013 :  13:08:57  Show Profile  Reply with Quote

Table Name: imtagfil

item_no    bin_no   Lot_no
 ABC         11       3B
 ABC         11       3B
 ABC         12       3B


I'm looking for a select statement that will return the number of records for each matching bin and lot number. 

item_no  bin_no   lot_no  count
ABC         11      3B      2
ABC         12      3B      1





webfred
Flowing Fount of Yak Knowledge

Germany
8679 Posts

Posted - 01/07/2013 :  13:39:01  Show Profile  Visit webfred's Homepage  Reply with Quote
select
item_no,
bin_no,
lot_no,
count(*) as [count]
from imtagfil
group by
item_no,
bin_no,
lot_no


Too old to Rock'n'Roll too young to die.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000