select mem.id, mem.name from member mem inner join payment pay on pay.member_id=mem.id where pay.year<>2000
I'm not sure which ID you would like to return from member or payment. I have referred to member. thanks. regards siva On Fri, Jun 21, 2013 at 3:46 PM, Abdur Rahman <[email protected]> wrote: > Hello all, I need help in writing the SQL Query i am struct at a point. > here goes my case. > > > I have two tables namely "member" and "payments" example structure of > member is > ========================= > | Id | Name | > ========================= > | 01 | Red | > | 02 | John | > | 03 | Patrick | > | 04 | Jane | > > > and the payment table is as follows > ======================================== > | Id | Year | member_Id | > ======================================== > | 01 | 1947 | 02 | > | 02 | 1958 | 03 | > | 03 | 2000 | 03 | > | 04 | 1988 | 04 | > > i want to fetch the records from the member table who are not made the > payment in the given year. for example if i enter 2000 > > it must return > ========================= > | Id | Name | > ========================= > | 01 | Red | > | 02 | John | > | 04 | Jane | > > can any one tell me how to query it. > > thanks in advance. > _______________________________________________ > ILUGC Mailing List: > http://www.ae.iitm.ac.in/mailman/listinfo/ilugc > ILUGC Mailing List Guidelines: > http://ilugc.in/mailinglist-guidelines > _______________________________________________ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc ILUGC Mailing List Guidelines: http://ilugc.in/mailinglist-guidelines
