SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Help with this problem sql
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

crosskarl
Starting Member

1 Posts

Posted - 02/01/2013 :  05:12:00  Show Profile  Reply with Quote
I am working with a world database that contains every land, continent, gpd(gross domestic product), population and area. I'm having a problem with writing out continents where every land in the continents gdp is not null. table is named world.

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 02/01/2013 :  06:33:02  Show Profile  Reply with Quote

SELECT land, continent, gpd, population ,area
FROM
(
SELECT *,
COUNT(CASE WHEN gdp IS NULL THEN 1 ELSE NULL END) OVER (PARTITION BY continent) AS gdpcnt
FROM world
)t
WHERE gdpcnt=0


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000