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
 Old Forums
 CLOSED - General SQL Server
 Count
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

ChetShah
Starting Member

37 Posts

Posted - 10/06/2005 :  07:15:58  Show Profile
Hi,

I'm not sure how to get this to work , i have a query that returns the following results:

ClaimRef
-----------
ADKIN00010
ADKIN00012
ADKIN00014
ADKIN00015
ADKIN00016
ADKIN00017
ADKIN00018
ADKIN00019
ADKIN00020

I want a write a count query which will return count of ADKIN = 9 ??

Chet

madhivanan
Premature Yak Congratulator

India
22469 Posts

Posted - 10/06/2005 :  07:19:46  Show Profile  Send madhivanan a Yahoo! Message
Try this

Select count(*) from yourTable where ClaimRef like 'ADKIN%'

Madhivanan

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

Kristen
Test

United Kingdom
22191 Posts

Posted - 10/06/2005 :  07:20:19  Show Profile
One of these perhaps?

SELECT LEFT(ClaimRef, 5), COUNT(*)
FROM MyTable
GROUP BY LEFT(ClaimRef, 5)

or

SELECT COUNT(*)
FROM MyTable
WHERE ClaimRef LIKE 'ADKIN[0-9][0-9][0-9][0-9][0-9]'

Kristen
Go to Top of Page

ChetShah
Starting Member

37 Posts

Posted - 10/06/2005 :  08:06:32  Show Profile
Thanks Kirsten

your queries work fine

Chet
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000