Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with a join

Status
Not open for further replies.

Dashley

Programmer
Dec 5, 2002
925
0
0
US
I have two tables
tbl1 = members M

memberID
Lastname
firstname

tbl2 = contributions C
memberid
contribdate
contribamt


want to select m.lastname. m.lastname from members M where they haven't made a contribution (c.contribdate) in the last 16 months, so that date would be since
2/01/2017 or close by.

Thanks

-dan

 

[tt]SELECT Lastname, firstname
FROM tbl1
WHERE memberID NOT IN (
SELECT memberID of members who DID pay in last 16 month)
[/tt]


---- Andy

There is a great need for a sarcasm font.
 
Code:
SELECT Members.*
FROM Members
LEFT JOIN Contributors ON Members.Id = Contributors.Id AND Contributors.contribdate >= DateAdd(mm, -16 GETDATE())
WHERE Contributors.Id IS NULL

NOT TESTED!!

Borislav Borissov
VFP9 SP2, SQL Server
 
Ok Thanks I'm going to try and get back on this today. I'll let you both know how it goes

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top