garethhall Posted February 28, 2011 Share Posted February 28, 2011 Hello, I have a SQL query below and it works but I have a slight problem. When fl.body_value is empty I don't get a result. So how do I Join on a table even if it's empty? In this case f.uri will always have a value. SELECT f.uri , fl.body_value FROM node n RIGHT JOIN field_data_com_slider_image fd ON n.nid = fd.entity_id RIGHT JOIN file_managed f ON fd.com_slider_image_fid = f.fid RIGHT OUTER JOIN field_data_body fl ON n.nid = fl.entity_id WHERE n.type = 'com_slider' AND n.status = 1 Link to comment https://forums.phpfreaks.com/topic/229183-mysql-query-help/ Share on other sites More sharing options...
fenway Posted March 1, 2011 Share Posted March 1, 2011 Why RIGHT JOIN? That just makes it hard to read. Link to comment https://forums.phpfreaks.com/topic/229183-mysql-query-help/#findComment-1181071 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.