1
0
mirror of https://github.com/fspc/Yellow-Bike-Database.git synced 2025-02-22 00:53:22 -05:00

Adds another MAX so newest expiration date is reflected.

This commit is contained in:
Jonathan Rosenbaum 2017-07-17 19:06:48 +00:00
parent 8089b40f19
commit 7ce6389cd6

View File

@ -46,7 +46,7 @@ FROM shop_hours
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
GROUP BY contact_id) AS members
GROUP by contact_id ORDER by sort_hours DESC, sort_visits DESC;";
GROUP by contact_id ORDER by <div style="text-align: center;">sort_hours</div> DESC, sort_visits DESC;";
$patrons = mysql_query($query, $YBDB) or die(mysql_error());
while ($result = mysql_fetch_assoc($patrons)) {
@ -58,7 +58,7 @@ $purchase_query = "SELECT contacts.contact_id,
CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
CONCAT(first_name, ' ', last_name) AS normal_full_name,
contacts.email AS email, contacts.phone AS phone,
MAX(transaction_log.date) AS sort_hours, SUBSTRING_INDEX(DATE_ADD(date, INTERVAL 365 DAY), ' ', 1) AS expiration_date
MAX(transaction_log.date) AS sort_hours, MAX(SUBSTRING_INDEX(DATE_ADD(date, INTERVAL 365 DAY), ' ', 1)) AS expiration_date
FROM transaction_log
LEFT JOIN contacts ON transaction_log.sold_to = contacts.contact_id
WHERE SUBSTRING_INDEX(date, ' ', 1) <= DATE_ADD(date, INTERVAL 365 DAY)