Solved

Ignoring NULL data in SQL query?

Posted on 2007-03-20
3
1,208 Views
Last Modified: 2012-05-05
CREATE VIEW [Top Rated Games] AS
SELECT TOP 100 Count(*) AS Cnt, GameID, Rating
FROM tbComments
GROUP BY GameID, Rating
ORDER BY Cnt DESC, Rating, GameID

I need to exclude null data from the "Rating" field. How would I do this?
0
Comment
Question by:ESSGroup
3 Comments
 
LVL 9

Accepted Solution

by:
dbeneit earned 125 total points
ID: 18760504
SELECT TOP 100 Count(*) AS Cnt, GameID, Rating
FROM tbComments
where not Rating is null
GROUP BY GameID, Rating
ORDER BY Cnt DESC, Rating, GameID
0
 
LVL 10

Expert Comment

by:lahousden
ID: 18760505
CREATE VIEW [Top Rated Games] AS
SELECT TOP 100 Count(*) AS Cnt, GameID, Rating
FROM tbComments
where rating is not null
GROUP BY GameID, Rating
ORDER BY Cnt DESC, Rating, GameID
0
 

Author Comment

by:ESSGroup
ID: 18760523
Thanks guys! Works perfect. I gave all points to dbeneit since his reply came first.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how the fundamental information of how to create a table.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question