DarkMantis
DarkMantis

Reputation: 1516

SQL join issue with multiple columns with the same name but different value

I have a bit of an issue with my SQL statement. It is a bit hard to explain so I will show you:

SELECT  exp_channel_data.field_id_102,
        exp_channel_data.field_id_104,
        exp_channel_data.field_id_126,
        exp_channels.deft_status
FROM exp_channel_data
  INNER JOIN exp_channels
    ON exp_channels.channel_id = exp_channel_data.channel_id
  INNER JOIN exp_channel_titles
    ON exp_channels.channel_id = exp_channel_titles.channel_id
WHERE exp_channels.channel_id = 18
AND exp_channel_titles.channel_id = 19

The bit that doesn't work is the AND exp_channel_titles.channel_id = 19

Any ideas on how to solve this issue?

Thanks in advance!

Upvotes: 0

Views: 171

Answers (1)

podiluska
podiluska

Reputation: 51494

You've joined on exp_channels.channel_id = exp_channel_titles.channel_id and are filtering on

exp_channels.channel_id = 18 
exp_channel_titles.channel_id = 19 

so there can never be any results

Upvotes: 6

Related Questions