Miko Posted February 24, 2010 Share Posted February 24, 2010 Hi, I'm trying to create a query that will get data from t1 and if not found go search in t2. I have this for the moment: SELECT * FROM tbl1, tbl2 WHERE tbl1.clnr = '$clnr' OR tbl2.clnr = '$clnr' This kinda works but Instead of receiving 1 result I get the same result 100 times. Anyone an idea? thanks Link to comment https://forums.phpfreaks.com/topic/193232-very-simple-query/ Share on other sites More sharing options...
fenway Posted February 24, 2010 Share Posted February 24, 2010 You can't do that -- that' a cartesian product. You need to JOIN the two tables, and then, depending on what's in that column, use COALESCE(). Link to comment https://forums.phpfreaks.com/topic/193232-very-simple-query/#findComment-1017658 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.