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] Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.