agge Posted March 19, 2007 Share Posted March 19, 2007 TB1 u_ID Name Country 1 A 2 3 4 5 Link to comment https://forums.phpfreaks.com/topic/43385-solved-select-over-two-tables-with-specifik-values/ Share on other sites More sharing options...
per1os Posted March 19, 2007 Share Posted March 19, 2007 What is the question? Link to comment https://forums.phpfreaks.com/topic/43385-solved-select-over-two-tables-with-specifik-values/#findComment-210694 Share on other sites More sharing options...
bwochinski Posted March 19, 2007 Share Posted March 19, 2007 I assume this was accidentally submitted before the post was finished. Link to comment https://forums.phpfreaks.com/topic/43385-solved-select-over-two-tables-with-specifik-values/#findComment-210696 Share on other sites More sharing options...
agge Posted March 19, 2007 Author Share Posted March 19, 2007 TB1 TB2 u_ID Name Country n_ID nick 1 A USA 1 A 2 B AUSTRALIA 1 B 3 DA SWEDEN 3 C 4 C USA 4 A 5 FA USA 5 B This is the SELECT formula I want to work: SELECT * FROM TB1, TB2 WHERE name LIKE '%a%' AND nick LIKE '%a%' WHERE country='USA'; If I split it up I get one to work: SELECT * FROM TB1 WHERE name LIKE '%a%' AND country='USA'; -- This give me u_ID 1 & 5 but how to make the other one to work: SELECT * TB2 WHERE nick LIKE '%a%* AND TB1.country='USA'; -- I doesnt work, but this is how I want it to work in some other code formula, it should be n_ID 1 & 4 who is selected. Link to comment https://forums.phpfreaks.com/topic/43385-solved-select-over-two-tables-with-specifik-values/#findComment-210725 Share on other sites More sharing options...
bwochinski Posted March 19, 2007 Share Posted March 19, 2007 I think this is the SQL you would want... SELECT * FROM TB1 LEFT JOIN TB2 ON name=nick WHERE country='USA'; But I'm really not sure what this data is or what you're trying to do. Link to comment https://forums.phpfreaks.com/topic/43385-solved-select-over-two-tables-with-specifik-values/#findComment-210732 Share on other sites More sharing options...
per1os Posted March 19, 2007 Share Posted March 19, 2007 Remember, MySQL is case-sensitive. a lowercase a means something different than an uppercase A. It reminds me of someone's signature on this board: Capitalization is the difference between "I had to help my uncle Jack off a horse.." and "I had to help my uncle jack off a horse.." Link to comment https://forums.phpfreaks.com/topic/43385-solved-select-over-two-tables-with-specifik-values/#findComment-210764 Share on other sites More sharing options...
agge Posted March 19, 2007 Author Share Posted March 19, 2007 I think this is the SQL you would want... SELECT * FROM TB1 LEFT JOIN TB2 ON name=nick WHERE country='USA'; But I'm really not sure what this data is or what you're trying to do. But when I use this SELECT name and nick must be the same, and that is not always in that way, n_ID 4, nick could be Abraham and there is no name wich fits thats in TB1, but it still assigned to country=USA, you know what I mean Link to comment https://forums.phpfreaks.com/topic/43385-solved-select-over-two-tables-with-specifik-values/#findComment-210770 Share on other sites More sharing options...
bwochinski Posted March 19, 2007 Share Posted March 19, 2007 But I'm really not sure what this data is or what you're trying to do. You're going to have to explain exactly what it is you want to do, preferably in terms of an example. Link to comment https://forums.phpfreaks.com/topic/43385-solved-select-over-two-tables-with-specifik-values/#findComment-210784 Share on other sites More sharing options...
agge Posted March 20, 2007 Author Share Posted March 20, 2007 This on worked just to add LIKE after nick=name. Thanks. SELECT * FROM `TB1`LEFT JOIN TB2 ON nick = name [b]LIKE '%e%'[/b] WHERE country = 'USA'; Link to comment https://forums.phpfreaks.com/topic/43385-solved-select-over-two-tables-with-specifik-values/#findComment-211034 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.