Solved

Ignoring NULL data in SQL query?

Posted on 2007-03-20
3
1,215 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

728 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