Why doesn't my qry show all records from vPortfolio?
Its only returning those where it finds a matching record in vPortfolioTransaction.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeCommented:
I cannot open your database (company policy), but generally it is because you used an INNER JOIN rather than a left join.  I think what you want would look something like:

SELECT P.ID, P.Field2, P.Field3, PT.Field1
FROM vPortfolio as P
LEFT JOIN vPortfolioTransaction as PT
ON P.ID = PT.Portfolio_ID
ShawnGrayAuthor Commented:
Here's the sql view; seems correct to me but still missing records from vPortfolio:

SELECT vPortfolioTransaction.PortfolioID, vPortfolioTransaction.TradeDate, vPortfolioTransaction.TradeAmount, vPortfolioTransaction.TransactionCode
FROM vPortfolioTransaction RIGHT JOIN vPortfolio ON vPortfolioTransaction.PortfolioID = vPortfolio.PortfolioID
WHERE (((vPortfolioTransaction.TradeDate)=#9/25/2013#) AND ((vPortfolioTransaction.TransactionCode)="lo"))
ORDER BY vPortfolioTransaction.PortfolioID;
ShawnGrayAuthor Commented:
If I remove all criteria its ok.
When I add
WHERE (((vPortfolioTransaction.TransactionCode)="lo"))

I removes the [PortfolioID]s that don't have 'lo'
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

ShawnGrayAuthor Commented:
Guess I missed something obvious:

WHERE (((vPortfolioTransaction.TransactionCode)="lo")) OR (((vPortfolioTransaction.TransactionCode) Is Null))

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dale FyeCommented:
Why doesn't my qry show all records from vPortfolio?  How would you know, you don't have any fields from vPortfolio in your SELECT statement.

Then you need to use a subquery on your vPortfolioTransaction table.  Try:

SELECT vPortfolio.PortfolioID
            , sub.PortfolioID
            , sub.TradeDate
            , sub.TradeAmount
            , sub.TransactionCode
FROM vPortfoilo
SELECT PortfolioID, TradeDate, TradeAmount, TransactionCode
FROM vPortfolioTransaction
WHERE TradeDate=#9/25/2013# AND TransactionCode="lo") as Sub
ON vPortfolio.PortfolioID = sub.PortfolioID
ORDER BY vPortfolio.PortfolioID;
ShawnGrayAuthor Commented:
Missed an "OR"' clause in my sql stmt
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.