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

x
?
Solved

How do I create a select statement with an outerjoin on access queries?

Posted on 2008-06-25
3
Medium Priority
?
200 Views
Last Modified: 2013-11-27
I have an asp page that queries an access query.  I now need to join the query results from one query with those from another query in the same db. My question is how do I outer join vwResults8.Team on vwResults2.Team.  My existing select statement is:

SELECT Team,  SUM(EffectiveRevenueReal) AS Rev From vwResults2 GROUP BY Team Order By SUM(EffectiveRevenueReal) DESC

I'd like to select all fields from vwResults8 and join on vwResults8.Team
0
Comment
Question by:hologosesh
[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
  • 2
3 Comments
 
LVL 32

Expert Comment

by:Daniel Wilson
ID: 21866257
I'm writing this as though you want ALL records from vwResults2 and matching from vwResults8.  If the other way around, change LEFT to RIGHT.  If all from both, change LEFT to FULL
SELECT Team,  SUM(EffectiveRevenueReal) AS Rev,
  vwResults8.*
From vwResults2 LEFT Outer Join vwResults8 on vwResults2.Team = vwResults8.Team
GROUP BY Team Order By SUM(EffectiveRevenueReal) DESC

Open in new window

0
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 500 total points
ID: 21866284
Hold on ... messed up some of the GROUP BY stuff:

Replace the Field1 - FieldN with real field names
SELECT Team,  SUM(EffectiveRevenueReal) AS Rev,
  vwResults8.*
From vwResults2 LEFT Outer Join vwResults8 on vwResults2.Team = vwResults8.Team
GROUP BY vwResults2.Team ,
vwResults8.Field1, vwResults8.Field2, ... vwResults8.FieldN
Order By SUM(EffectiveRevenueReal) DESC

Open in new window

0
 

Author Closing Comment

by:hologosesh
ID: 31470564
Works great, thanks.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

609 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