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.

Need help with SQL Select Count statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
APanian - 07 Mar 2008 14:32 GMT
I want to pull records from a "Column" within a "Table".  I recall in the
past doing a:

SELECT COUNT "n" FROM .... (This is where I am lost!).

I am hoping to pull the contents of the column in a table.

Thanks

Signature

A. Panian
Systems Engineer
Boston, MA

DXC - 07 Mar 2008 15:12 GMT
Isn't column count same as the table count ? Do,

Select count(*) from MyTable

If you need the count of the specific values in that column, then do,

Select count(*) from MyTable where Col1 = 'value'

> I want to pull records from a "Column" within a "Table".  I recall in the
> past doing a:
[quoted text clipped - 4 lines]
>
> Thanks
DXC - 07 Mar 2008 15:33 GMT
If you want to insert it into a table:

For only the count as number:

select count(*) AS TheCount Into table1 from MyTable

For the contents of the column:

select Col1 as MYCol1 Into table2  from MyTable

> Isn't column count same as the table count ? Do,
>
[quoted text clipped - 12 lines]
> >
> > Thanks
Tom W - 10 Mar 2008 12:58 GMT
Or my favorite:

select col1, count(*)
From MyTable
Group by col1
Order by col1

To get a count of all the values of col1.

Tom

>Isn't column count same as the table count ? Do,
>
[quoted text clipped - 14 lines]
>>
>>Thanks

Signature

E-mail correspondence to and from this address may be subject to the
North Carolina Public Records Law and may be disclosed to third parties.

 
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.