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
Solved

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

Posted on 2008-06-25
3
192 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
  • 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 125 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

860 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