Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
| Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 17th, 2004, 04:59 PM
Registered User
 
Join Date: Mar 2004
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to programmer_kay
Default SQL query for count

Hi,
   I have two tables as table1(featureid) and table2(featureid). The difference is table1 has duplicate records of feature ids like
Featureid
 1
 1
 2
and table 2 has unique set of featureids
Feautreid
 1
 2

So, now I want something which counts how many entries of a particular featureid are there in table1. i.e.

featureid count
  1 2
  2 1

How can I do this.
 Any help is appreciated. Thanks!!


  #2 (permalink)  
Old April 17th, 2004, 07:30 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Is this what you are looking for?

select featureid, RowCountValue=count(*) from Table1
group by featureid order by featureid

Hope that helps.

Cheers!

-Vijay G


Similar Threads
Thread Thread Starter Forum Replies Last Post
new display count query carswelljr SQL Language 9 May 7th, 2007 04:59 PM
SQL count query not giving correct results hman SQL Language 2 March 16th, 2005 07:06 AM
SQL count query not giving correct results hman SQL Server 2000 1 March 15th, 2005 01:15 PM
query count? Raif Access 1 June 18th, 2004 05:08 PM
SQL query for count programmer_kay ADO.NET 1 April 18th, 2004 02:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.