Solved

Ignoring NULL data in SQL query?

Posted on 2007-03-20
3
1,175 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks guys! Works perfect. I gave all points to dbeneit since his reply came first.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now