agge Posted March 22, 2007 Share Posted March 22, 2007 How to control that the nick from table2 also have the value contry='USA' from table1. They using same id. I want to select id from table2 where nick LIKE %a% and where country from table2 is USA. SELECT id FROM table1 WHERE name LIKE '%a%' AND country='USA' UNION SELECT id FROM table2 WHERE nick LIKE '%a%' [i][color=blue][font=Verdana]AND table1.country='USA'[/font][/color][/i] Link to comment https://forums.phpfreaks.com/topic/43819-using-one-select-from-two-tables-with-union-how-to-control/ Share on other sites More sharing options...
fenway Posted March 22, 2007 Share Posted March 22, 2007 Are you sure you mean UNION here and not JOIN? Link to comment https://forums.phpfreaks.com/topic/43819-using-one-select-from-two-tables-with-union-how-to-control/#findComment-212790 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.