Question: SELECT member.member _ ID , CONCAT ( member . Last _ Name, ' , ' , member.First _ Name ) AS Name, member.Email, CONCAT (

SELECT
member.member_ID,
CONCAT(member.Last_Name, ',', member.First_Name) AS Name,
member.Email,
CONCAT(member.Phone_Area_Code, '-', member.Phone_Number) AS Phone,
MAX(member_fee_payment.Date_Paid) AS Latest_Payment_Date,
DATEDIFF('2018-02-07', MAX(member_fee_payment.Date_Paid)) AS Days_to_Expiration
FROM
member
JOIN
member_fee_payment ON member.member_ID = member_fee_payment.member_ID
WHERE
DATEDIFF('2018-02-07', MAX(member_fee_payment.Date_Paid))=30
GROUP BY
member.member_ID,
member.Last_Name,
member.First_Name,
member.Email,
member.Phone_Area_Code,
member.Phone_Number;
this code is wrong incorrect feild list help me use a proper feild list to test the sql code
Members whose membership will expire within 30 days from Feb 7,2018
Explanation:- To find the already expired members we have to check the date of the last paid membership fees and if it is less than 7th February 2018 and it has not been renewed then the membership has expired. So we have to select both the member and member_fee_payment table and check the corresponding membership with their unique member id.
-> The SQL query to show members whose membership will expire within 30 days of February 7th,2018 is as followings:-
SELECT * FROM member,member_fee_payment where member.member_ID == member_fee_payment.id and DATEDIFF(day,Date_Paid,'2018-02-07')=30
use columns membe ID Name last, First Name - email - phone # - latest payment date - number of days to expiration
 SELECT member.member_ID, CONCAT(member.Last_Name, ',', member.First_Name) AS Name, member.Email, CONCAT(member.Phone_Area_Code, '-', member.Phone_Number)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!