I am trying to export from two tables based on multiple records in the second table.
I have a working SQL :
SELECT first_name AS 'First Name', last_name AS 'Family Name', published AS 'Payment status', fv17
.field_value
AS 'Mobile phone No.', fv26
.field_value
AS 'Event Option', fv27
.field_value
AS 'Dietary Restrictions'
FROM #_eb_registrants as reg
LEFT JOIN #_eb_field_values
AS fv17
ON (fv17
.registrant_id
= reg
.id
)
LEFT JOIN #_eb_field_values
AS fv26
ON (fv26
.registrant_id
= reg
.id
)
LEFT JOIN #_eb_field_values
AS fv27
ON (fv27
.registrant_id
= reg
.id
)
WHERE reg.event_id=295 AND fv26
.field_id
= '26' AND fv27
.field_id
= '27' AND fv17
.field_id
= '17' ;
BUT it only show me the records where there are values in #_eb_field_values
I want to output all the records from #_eb_registrants with values from #_eb_field_values even if there are no values in #_eb_field_values for the registrant (if that make sense).
Any help gratefully received. !
Thanks.