Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Ignoring NULL data in SQL query?

Posted on 2007-03-20
3
Medium Priority
?
1,224 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 500 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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how the fundamental information of how to create a table.

604 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