ifnull(GROUP_CONCAT(DISTINCT concat(ifnull(her_source1.porm,' '),'     ',(ifnull(her_source1.srcetype,' '),'     ',ifnull(her_source1.author,' '),'     ',ifnull(her_source1.year,' '),'     ',ifnull(her_source1.title,' '),'     ',ifnull(her_source1.journal,' '),'     ',ifnull(her_source1.other,' ')) SEPARATOR '[br]' ),' ') as source1


LEFT JOIN her_source1_link ON her_core.watprn = her_source1_link.watprn
LEFT JOIN her_source1 ON her_source1_link.bib_unique=her_source1.bib_unique


"
select her_core.prn
ifnull(GROUP_CONCAT(DISTINCT concat(ifnull(her_source1.srcetype,' ')) as s1 SEPARATOR ',     '),' ')
from her_core
LEFT JOIN her_source1_link ON her_core.watprn = her_source1_link.watprn
LEFT JOIN her_source1 ON her_source1_link.bib_unique=her_source1.bib_unique
group by her_core.prn
"
the above - in " is returning all records on the left i.e. the prns, but not the records on the right i.e the source type. Although it is replacing NULL with ' ' and giving the s1 alias to the column.


Chris' sql

SELECT her_core.prn, her_core.name, her_core.form, her_core.desc_1, geo_locations.ngr, geo_locations.community, her_status.status, her_status.reference, her_core_site_type.type, her_core_site_type.period, her_artefact.quantity, her_artefact.ftype, her_artefact.fmaterial, her_source1.author, her_source1.year, her_source1.title
FROM her_core
LEFT JOIN her_core_site_type ON her_core.watprn = her_core_site_type.watprn
LEFT JOIN geo_locations ON her_core.watprn = geo_locations.watprn
LEFT JOIN her_status ON her_core.watprn = her_status.watprn
LEFT JOIN her_artefact ON her_core.watprn = her_artefact.watprn
LEFT JOIN her_source1_link ON her_core.watprn = her_source1_link.watprn
LEFT JOIN her_source1 ON her_source1_link.bib_unique = her_source1.bib_unique
WHERE her_core_site_type.type LIKE '%barrow%'
AND geo_locations.unitary LIKE 'Pembrokeshire'
ORDER BY her_core.name, her_core_site_type.period, her_core_site_type.type, her_artefact.fmaterial, her_source1.author, her_source1.year
LIMIT 0 , 30

Is not bringing the sources in either.

This is something to do with the linking table.