Ok..basically I have a table with a duplicated field i need to work with. I need to select all the distinct memno's from this table with the related ContributionAmt AND ContributionDate
My table has 4 fields:
PacEntryId ('Pk'),MemNo ('Fk'),ContibutionAmt, and ContributionDate
Now..I knwo I have
--Select Distinct(Memno) FROM TblPacContributions--2527 records
ANd in My related table I have
--Select count(Memno) From TblProspectMember --30331 records
Wich to me tells me If I want All related member info for ppl whom have contributed I should return:
30331
ANd for ppl whom have not contibuted:
30331-2527 =27804 non contributors
So I want all the distinct memberno's from TblPacCOntibutions AND
I need to know how to decide whom did or did not contribute..
I believe I get the DId not contribute using a left outer join:
Here is the cod eI tried for creating a vw of distinct member numbers from TblPacContributions with the memno's last contribution date:
SELECT TOP 100 PERCENT a.Memno, a.ContributionDate, a.ContributionAmt
FROM (SELECT DISTINCT Memno, ContributionDate, ContributionAmt
FROM TblPacContributions) a INNER JOIN
(SELECT DISTINCT Memno, ContributionDate, ContributionAmt
FROM TblPacContributions) b ON a.Memno = b.Memno AND a.ContributionDate <= b.ContributionDate
GROUP BY a.Memno, a.ContributionDate, a.ContributionAmt
HAVING (COUNT(*) <= 1)
ORDER BY a.Memno DESC
but this returns 2507 records
My table has 4 fields:
PacEntryId ('Pk'),MemNo ('Fk'),ContibutionAmt, and ContributionDate
Now..I knwo I have
--Select Distinct(Memno) FROM TblPacContributions--2527 records
ANd in My related table I have
--Select count(Memno) From TblProspectMember --30331 records
Wich to me tells me If I want All related member info for ppl whom have contributed I should return:
30331
ANd for ppl whom have not contibuted:
30331-2527 =27804 non contributors
So I want all the distinct memberno's from TblPacCOntibutions AND
I need to know how to decide whom did or did not contribute..
I believe I get the DId not contribute using a left outer join:
Here is the cod eI tried for creating a vw of distinct member numbers from TblPacContributions with the memno's last contribution date:
SELECT TOP 100 PERCENT a.Memno, a.ContributionDate, a.ContributionAmt
FROM (SELECT DISTINCT Memno, ContributionDate, ContributionAmt
FROM TblPacContributions) a INNER JOIN
(SELECT DISTINCT Memno, ContributionDate, ContributionAmt
FROM TblPacContributions) b ON a.Memno = b.Memno AND a.ContributionDate <= b.ContributionDate
GROUP BY a.Memno, a.ContributionDate, a.ContributionAmt
HAVING (COUNT(*) <= 1)
ORDER BY a.Memno DESC
but this returns 2507 records