I would like to grab the other side of the Trans Type="TR" and ignore the Trans Type= "R" if possible. The trans type ="R" appears to double up when I do a self join on the table. Is it possible to self join and grab only the trans type ="TR"? and pull in the R without it selfjoining or searching for the other side of the equation. The type "R" is where that dept. took the reduction and the trans type TR is where another dept took the reduction.
If i did it in two queries it would be easy I would just grab the type TRs in a self join and pull the type R only going after the table without a self-join. Perhaps this is what I will need to do?
Table 1
Trans ID Trans Date Dept Nbr Org Nbr Trans Type Amount Dept Trans To Org Tran To
519781 6/17/2012 A78 210 R 273
519781 6/17/2012 A78 510 R 19
519781 6/17/2012 A78 310 R 32
532470 6/28/2012 A78 526 TR 22 A9R 994
SELECT Table1.Trans ID, Table1.Trans Date, Left([Table1]![DeptOrg],3) AS DeptNmbr, Right([Table1]![DeptOrg],3) AS ORG, Table1.DeptOrg, Table1.Trans Type, Table1.Amount, Table1_1.Trans Type, Left([Table1_1]![DeptOrg],3) AS DeptIn, Right([Table1_1]![DeptOrg],3) AS ORGIN
FROM Table1 LEFT JOIN Table1 AS Table1_1 ON (Table1.Trans Date = Table1_1.Trans Date) AND (Table1.Trans ID = Table1_1.Trans ID)
WHERE (((Left([Table1]![DeptOrg],3)) Like "A78*") AND ((Table1.DeptOrg) Not Like "A9R*") AND ((Table1.Trans Type)="TR") AND ((Left([Table1_1]![DeptOrg],3)) Like "G9R*")) OR (((Left([Table1]![DeptOrg],3)) Like "A78*") AND ((Table1.Trans Type)="R"));
If i did it in two queries it would be easy I would just grab the type TRs in a self join and pull the type R only going after the table without a self-join. Perhaps this is what I will need to do?
Table 1
Trans ID Trans Date Dept Nbr Org Nbr Trans Type Amount Dept Trans To Org Tran To
519781 6/17/2012 A78 210 R 273
519781 6/17/2012 A78 510 R 19
519781 6/17/2012 A78 310 R 32
532470 6/28/2012 A78 526 TR 22 A9R 994
SELECT Table1.Trans ID, Table1.Trans Date, Left([Table1]![DeptOrg],3) AS DeptNmbr, Right([Table1]![DeptOrg],3) AS ORG, Table1.DeptOrg, Table1.Trans Type, Table1.Amount, Table1_1.Trans Type, Left([Table1_1]![DeptOrg],3) AS DeptIn, Right([Table1_1]![DeptOrg],3) AS ORGIN
FROM Table1 LEFT JOIN Table1 AS Table1_1 ON (Table1.Trans Date = Table1_1.Trans Date) AND (Table1.Trans ID = Table1_1.Trans ID)
WHERE (((Left([Table1]![DeptOrg],3)) Like "A78*") AND ((Table1.DeptOrg) Not Like "A9R*") AND ((Table1.Trans Type)="TR") AND ((Left([Table1_1]![DeptOrg],3)) Like "G9R*")) OR (((Left([Table1]![DeptOrg],3)) Like "A78*") AND ((Table1.Trans Type)="R"));