Привет! Я сделал вот так, чтобы получить данные о членах для способа оплаты, тип наличных
SELECT members.member_Id, members.member_Lastname, members.member_Firstname, members.member_PostCode,
members.member_Reference, members.member_Dob,30*memberToMship_ChargePerPeriod/DateDiff(memberToMship_EndDate, memberToMship_StartDate) As monthly_amount, mshiptypes.mshipType_Name, mshipstatustypes.mshipStatusType_Name,
membertomships.memberToMship_EndDate, IF(mshipOption_Period='year', TIMESTAMPDIFF (YEAR,memberToMship_StartDate, memberToMship_EndDate),
TIMESTAMPDIFF (MONTH ,memberToMship_StartDate,memberToMship_EndDate ) ) *memberToMship_ChargePerPeriod As Total
FROM members LEFT JOIN membertomships ON membertomships.member_Id = members.member_Id,
LEFT JOIN mshipstatustypes ON mshipstatustypes.mshipStatusType_Id = membertomships.mshipStatusType_Id,
LEFT JOIN mshipoptions ON mshipoptions.mshipOption_Id = membertomships.mshipOption_Id,
LEFT JOIN mshiptypes ON mshiptypes.mshipType_Id = mshipoptions.mshipType_Id,
WHERE membertomships.memberToMship_PayMethod='Cash'
AND members.member_Active LIKE 'y%'
AND (mshipstatustypes.mshipStatusType_Id='2'
OR mshipstatustypes.mshipStatusType_Id = '3'
OR mshipstatustypes.mshipStatusType_Id='6')"
и другой запрос, подобный этому, для получения деталей о членах с помощью карточки типа метода
SELECT members.member_Id, members.member_Lastname, members.member_Firstname, members.member_PostCode,
members.member_Reference, members.member_Dob,
30*memberToMship_ChargePerPeriod/DateDiff(memberToMship_EndDate, memberToMship_StartDate) As monthly_amount,
mshiptypes.mshipType_Name, mshipstatustypes.mshipStatusType_Name,
membertomships.memberToMship_EndDate,
IF(mshipOption_Period='year', TIMESTAMPDIFF (YEAR,memberToMship_StartDate, memberToMship_EndDate),
TIMESTAMPDIFF (MONTH ,memberToMship_StartDate,memberToMship_EndDate ) ) *memberToMship_ChargePerPeriod As Total
FROM members LEFT JOIN membertomships ON membertomships.member_Id = members.member_Id
LEFT JOIN mshipstatustypes ON mshipstatustypes.mshipStatusType_Id = membertomships.mshipStatusType_Id
LEFT JOIN mshipoptions ON mshipoptions.mshipOption_Id = membertomships.mshipOption_Id
LEFT JOIN mshiptypes ON mshiptypes.mshipType_Id = mshipoptions.mshipType_Id
WHERE membertomships.memberToMship_PayMethod='Card'
AND members.member_Active LIKE 'y%'
AND (mshipstatustypes.mshipStatusType_Id='2' OR mshipstatustypes.mshipStatusType_Id = '3'
OR mshipstatustypes.mshipStatusType_Id='6')"
но я хочу, чтобы данные о членах тех, у кого есть способы оплаты, были "наличными и картой" (оба типа участников)
помог бы в этом вопросе ...
Я использую MySQL
Большое спасибо ........
Модифицированный запрос
SELECT members.member_Id, members.member_Lastname, members.member_Firstname, members.member_PostCode,
members.member_Reference, members.member_Dob,30*memberToMship_ChargePerPeriod/DateDiff(memberToMship_EndDate, memberToMship_StartDate) As monthly_amount, mshiptypes.mshipType_Name, mshipstatustypes.mshipStatusType_Name,
membertomships.memberToMship_EndDate,
IF(mshipOption_Period='year', TIMESTAMPDIFF (YEAR,memberToMship_StartDate, memberToMship_EndDate),
TIMESTAMPDIFF (MONTH ,memberToMship_StartDate,memberToMship_EndDate ) ) *memberToMship_ChargePerPeriod As Total
FROM members
INNER JOIN membertomships ON membertomships.member_Id = members.member_Id
INNER JOIN mshipstatustypes ON mshipstatustypes.mshipStatusType_Id = membertomships.mshipStatusType_Id
INNER JOIN mshipoptions ON mshipoptions.mshipOption_Id = membertomships.mshipOption_Id
INNER JOIN mshiptypes ON mshiptypes.mshipType_Id = mshipoptions.mshipType_Id
WHERE membertomships.memberToMship_PayMethod IN ('Card','Card','Cheque')
AND members.member_Active LIKE 'y%'
AND ( mshipstatustypes.mshipStatusType_Id='2' OR mshipstatustypes.mshipStatusType_Id = '3'
OR mshipstatustypes.mshipStatusType_Id='6');
, но он не показывает правильные значения ..
Привет, но одна проблемаУ меня есть шесть членов карты и 3 члена наличных по отдельности, это показывает 6 и три, но при объединении (карта и наличные деньги) это показывает только 4. Но это должно быть показано (6+ 3), я не знаю, как это было быПожалуйста скажите любое решение.