MySQL Forums
Forum List  »  Newbie

Re: Grouping query
Posted by: Peter Brawley
Date: November 20, 2019 11:29AM

Is this what you mean?

SELECT
  dcea4_eb_events.event_date,
  dcea4_eb_events.title,
  dcea4_eb_registrants.id,
  dcea4_eb_registrants.first_name,
  dcea4_eb_registrants.last_name,
  dcea4_eb_registrants.email,
  dcea4_eb_registrants.register_date,
  dcea4_eb_registrants.amount,
  dcea4_eb_registrants.comment,
  Group_Concat( concat("id=",field_id," value=,field_value") ) as "IDs/VALUES"
FROM dcea4_eb_events
JOIN dcea4_eb_registrants  ON dcea4_eb_registrants.event_id = dcea4_eb_events.id
JOIN dcea4_eb_field_values ON dcea4_eb_field_values.registrant_id = dcea4_eb_registrants.id
WHERE 1=1
  AND dcea4_eb_field_values.field_id IN(14,26,27,15)
  AND dcea4_eb_registrants.published <> 2
  AND dcea4_eb_registrants.published IS NOT NULL
  AND (dcea4_eb_registrants.published = 1 OR dcea4_eb_registrants.payment_method = "os_offline")
[ AND (dcea4_eb_registrants.register_date {RegistrationDate} ) ]
[ AND REPLACE(dcea4_eb_events.title,'\'','') in ({Club}) ]
GROUP BY dcea4_eb_events.event_date,dcea4_eb_events.title,dcea4_eb_registrants.id,
  dcea4_eb_registrants.first_name,dcea4_eb_registrants.last_name,
  dcea4_eb_registrants.email,dcea4_eb_registrants.register_date,
  dcea4_eb_registrants.amount,dcea4_eb_registrants.comment
ORDER BY dcea4_eb_registrants.register_date,dcea4_eb_events.title;

If not, please post Show Create Table results for the tables and enough sample Inserts to generate a result.

Options: ReplyQuote


Subject
Written By
Posted
November 20, 2019 10:12AM
Re: Grouping query
November 20, 2019 11:29AM
November 20, 2019 03:16PM
November 20, 2019 04:15PM
November 21, 2019 10:54AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.