Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count of No Nulls please

Status
Not open for further replies.

alexanderthegreat

IS-IT--Management
Sep 9, 2005
70
0
0
US
I need a count of all the AES_ES records without the nulls how can I do this?

SELECT dbo.AES_CONTACT_SCHOOL.SCHOOL_NAME, dbo.AES_ES_1.S1A1_D, dbo.AES_ES_1.S1A1_M, dbo.AES_ES_1.S1A1_T, dbo.AES_ES_1.S1A1_V
FROM dbo.AES_ES_1 CROSS JOIN
dbo.AES_CONTACT_SCHOOL
 
It's difficult to see how your data is structured based on your example. So, I will provide my own example.

Code:
Declare @Temp Table (Data Integer)

Insert Into @Temp Values(1)
Insert Into @Temp Values(NULL)
Insert Into @Temp Values(5)
Insert Into @Temp Values(NULL)
Insert Into @Temp Values(10)
Insert Into @Temp Values(20)

Select Count(1), Count(Data) From @Temp

Notice that there are 6 records being inserted into the temp table. Count(1) will tell you how many records there are. Count(Data) will tell you how many records are NOT NULL.

I'm not sure how to apply this to your example because it is not clear to me HOW your 2 tables relate to each other. If you can clarify your question a little, and provide some sample data, I may be able to help you more.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top