我有

会员表

member_Id
Last name
first name
postcode
reference


另一个表成员

member_Id
membertomship_lastdate
membertomship_paymentmethod  column with values money
member_id
membershipstatusid
membershipoptionid


另一个表的membershipstatustype表

membershipstatusid
memberstatustype_name


另一个表的会员类型

membershiptype_id
membershiptype_name


另一个表成员资格选项

membershiptype_id
membershipoptionid


我想为那些拥有membertomship_paymentmethod是金钱的会员获取姓氏和名字,以及memberstatustype_name,membershiptype_name和membertomship_lastdate

谁能帮我一下...

非常感谢。

最佳答案

像这样吗

SELECT
  member.lastname,
  member.firstname
  membershipstatustype.memberstatustype_name
  membershiptype.membershiptype_name
  memberstomships.membertomship_lastdate
FROM
  member
  INNER JOIN memberstomships ON member .member_id = memberstomships.memberid
  INNER JOIN membershipstatustype ON memberstomships.membershipstatusid = membershipstatustype.membershipstatusid
  INNER JOIN membershiptype ON membershipstatustype.membershiptype_name = membershiptype.membershiptype_name
WHERE
  UCASE(memberstomships.membertomship_paymentmethod) = 'MONEY'

09-16 04:24