Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 difficult sql statement

Author  Topic 

viperbyte
Posting Yak Master

132 Posts

Posted - 2011-12-14 : 17:11:25
Hello everyone. I need help on this sql statement bigtime. It's so envolved that I don't feel comfortable asking you good ppl to write it out for free. I put the job on vworker if you would please take a look at the job id 1795389. I had a hard time posting both databases on the project. Currently what I have as an attachement is the linked file. But I can supply the main database to you through email if you were to ask me for it. My email is juan.matos@juanmatos.net. If one of you folks were kind enough to help me out of course I would supply you with all the files you need to get the job done. The following query is the main one I need done. All the SMLN**** identifiers are sub-queries and are all included in the main database. I don't have much money so that's why I can only offer $45 this time. But hopefully I'll get a raise in my from now on projects and I can pay more in the future. But this is all I have for now; so sorry. If you were to show an interest in this job and if you contact me through vworker will you please mention that you're from sqlteam.com. Anyway this is the Access query that is killing me.

SELECT [County Demographics].FIPS, [County Demographics].County, [County Demographics].State, [County Demographics].BEARegion, PopulationGroupsTbl.PopulationGroupLabel, [County Demographics].[PopulationDensity2010 Decile], [County Demographics].[MedianHousingBuilt Decade], [County Demographics].[MedianAge Decile], [County Demographics].[ShareOver65 Decile], [County Demographics].[PercentBachelors Decile], [County Demographics].PercentNonWhiteDecile, [County Demographics].[PercentNotEnglish Decile], [County Demographics].[PerCapitaIncome2009 Decile], [County Demographics].[MedianHouseholdIncome2009 Decile], [County Demographics].[PercentCommuting Decile], SMLNSHRDATA.MillennialShare, SMLNSHRNATAVE.AvgOfMillennialShare AS NatAveMillennialShare, SMLNSHRNATAVE.Median AS MedianMillennialShare, SMLNSHRSTA.AvgOfMillennialShare, SMLNSHRREG.AvgOfMillennialShare, SMLNSHRPOP.AvgOfMillennialShare, SMLNSHRPDN.AvgOfMillennialShare, SMLNSHRHOU.AvgOfMillennialShare, SMLNSHRAGE.AvgOfMillennialShare, SMLNSHRSEN.AvgOfMillennialShare, SMLNSHREDU.AvgOfMillennialShare, SMLNSHRPNW.AvgOfMillennialShare, SMLNSHRPNE.AvgOfMillennialShare, SMLNSHRPCI.AvgOfMillennialShare, SMLNSHRMDI.AvgOfMillennialShare, SMLNSHROUT.AvgOfMillennialShare
FROM SMLNSHRNATAVE, PopulationGroupsTbl INNER JOIN ((SMLNSHRPOP INNER JOIN (((((((SMLNSHREDU INNER JOIN ((((SMLNSHRREG INNER JOIN (SMLNSHRSTA INNER JOIN [County Demographics] ON SMLNSHRSTA.State=[County Demographics].State) ON SMLNSHRREG.BEARegion=[County Demographics].BEARegion) INNER JOIN SMLNSHRHOU ON [County Demographics].[MedianHousingBuilt Decade]=SMLNSHRHOU.[MedianHousingBuilt Decade]) INNER JOIN SMLNSHRAGE ON [County Demographics].[MedianAge Decile]=SMLNSHRAGE.[MedianAge Decile]) INNER JOIN SMLNSHRSEN ON [County Demographics].[ShareOver65 Decile]=SMLNSHRSEN.[ShareOver65 Decile]) ON SMLNSHREDU.[PercentBachelors Decile]=[County Demographics].[PercentBachelors Decile]) INNER JOIN SMLNSHRPDN ON [County Demographics].[PopulationDensity2010 Decile]=SMLNSHRPDN.[PopulationDensity2010 Decile]) INNER JOIN SMLNSHRPNW ON [County Demographics].PercentNonWhiteDecile=SMLNSHRPNW.PercentNonWhiteDecile) INNER JOIN SMLNSHRPNE ON [County Demographics].[PercentNotEnglish Decile]=SMLNSHRPNE.[PercentNotEnglish Decile]) INNER JOIN SMLNSHRPCI ON [County Demographics].[PerCapitaIncome2009 Decile]=SMLNSHRPCI.[PerCapitaIncome2009 Decile]) INNER JOIN SMLNSHRMDI ON [County Demographics].[MedianHouseholdIncome2009 Decile]=SMLNSHRMDI.[MedianHouseholdIncome2009 Decile]) INNER JOIN SMLNSHROUT ON [County Demographics].[PercentCommuting Decile]=SMLNSHROUT.[PercentCommuting Decile]) ON SMLNSHRPOP.PopulationGroup=[County Demographics].PopulationGroup) INNER JOIN SMLNSHRDATA ON [County Demographics].FIPS=SMLNSHRDATA.FIPS) ON PopulationGroupsTbl.PopulationGroup=[County Demographics].PopulationGroup
ORDER BY [County Demographics].FIPS;
   

- Advertisement -