Trouble getting a left-join to work.

S

SP

I have two tables, A & B. Table B has adjustment factors of three
types, "COMM" being one of them. I want a query that generates all
rows of table A, and those where certain fields match, I want the
value of A.PD01 to be multiplied by the the "COMM" factor.

I have the following SQL, but it only generates the records where the
fields match, not all of them.

SELECT A.DV, A.AR, A.BU, A.MCLASS, A.CLASS, ![PD01]*[A]![PD01] AS
PD01
FROM A LEFT JOIN B ON (A.AR = .AR) AND (A.DV = .DV) AND (A.BU =
.BU) AND (A.MCLASS = .MCL)
WHERE ((![NAME]="COMM"));
 
S

Smallweed

It's your Where clause thats undermining the left join - records in A that
have no matching records in B will show Null for ![NAME] and are therefore
being left out of the list.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top