Inner join problem

Hi,

I am trying to make an inner join get me only the results from two tables, where there is a match.

trouble is, it is bringing back all possible records, which is no use.

the first query brings back the correct results from one table

the second query has the inner join but it brings back every possible record.


SELECT business_id
, div_tag
FROM page_blocks_to_scripts_set
WHERE business_id = 456
AND script_name = 'mainpage'
AND live_dev = 'dev'
AND is_equal_column = 'yes'
ORDER BY sequence_number

brings back three rows as it should/ought to.


SELECT 
business_id
, div_tag
FROM page_blocks_to_scripts_set AS tset
inner 
join website_scripts_to_tags AS tags  
  on tags.script_name = tset.script_name
and tags.script_name = 'mainpage'
where tset.business_id = 456
and tset.live_dev = 'dev'
and tset.is_equal_column = 'yes'
and tset.script_name = 'mainpage'

brings back all records, seemingly, ignoring the where clause

what am I missing, please?

bazz

silly oversight. I needed to include a join on a third table, to relate the div_tags, with the page_blocks.