1

This doesn't give me an error, but it also doesn't display any results. I'm trying to display only the entries that don't have a relationship. My relationship field is field_id_57, and I only want to display entries from channel_id_30. Am I doing something wrong?

{exp:query sql="SELECT * FROM exp_channel_data WHERE field_id_57 IS NULL && channel_id = '30'"}

content should display here

{/exp:query{
1

Since channel entry titles & data are stored in different tables, you will need to inner join the two tables together to get the Title of the entry. Something like this:

SELECT ecd.entry_id,
ect.entry_id,
ect.title 
FROM exp_channel_data AS ecd
INNER JOIN exp_channel_titles AS ect
ON ecd.entry_id = ect.entry_id
WHERE ecd.field_id_57 IS NULL
AND ecd.channel_id = '30'
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.