daniel0816 Posted September 8, 2013 Share Posted September 8, 2013 I have the two following queries: SELECT CUST_ID FROM Customers WHERE CUST_ID LIKE '%$criteria%' SELECT J_RefNum FROM Jobs WHERE J_RefNum LIKE '%$criteria%' How would I merge them together into one query without using union. Any help would be greatly appreciated thanks. Quote Link to comment Share on other sites More sharing options...
cataiin Posted September 8, 2013 Share Posted September 8, 2013 http://us2.php.net/manual/en/mysqli.multi-query.php Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted September 8, 2013 Share Posted September 8, 2013 (edited) a) STOP creating new threads for this problem. continue the same problem in your existing thread. b) you have been asked, repeatedly, to provide information about the relationship between your tables and to provide sample data and the result you expect from that data. if you cannot provide this information, no one can show you how to write the JOIN query using those tables. c) had you stuck with your very first thread, and provided the information in b), you would have solved this by now. Edited September 8, 2013 by mac_gyver Quote Link to comment Share on other sites More sharing options...
daniel0816 Posted September 8, 2013 Author Share Posted September 8, 2013 How is that relevant for this all I want to know is how to combine these two simple queries together and thats it. The relationships I have between my tables is not of your concern all I ask for is a simple solution to a small problem i.e. combine the two queries above. The result that I expect should be self explanatory through the two simple queries above I just want to know how to join them together into one query. Yes you are probably right I shouldnt be creating multiple threads but I really need to find a solution to this problem asap. Quote Link to comment Share on other sites More sharing options...
Barand Posted September 8, 2013 Share Posted September 8, 2013 The relationships I have between my tables is not of your concern The relationships between data items is of fundamental concern to anyone trying to query that data. If it isn't our concern then it is yours alone. Goodbye and stop wasting our time. Quote Link to comment Share on other sites More sharing options...
daniel0816 Posted September 8, 2013 Author Share Posted September 8, 2013 Well thanks alot Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 8, 2013 Share Posted September 8, 2013 Based upon what you have stated, my understanding is that you want the data from both of those two queries to be returned from a single query. If so, then the answer is to use UNION. So, what you are asking makes no sense because you are basically stating you want the results of a UNION query, but you don't want to use a UNION query. Sort of like asking how to stop a car, but without using the brakes. Now, if you are asking what I think you are asking - then it is a stupid question. So, I think mac_gyver is making an assumption that you really want something else. Specifically, something in which you need the data from those two queries based upon some relationship. I guess he is giving you some slack that you may not know how to properly ask the real question so he is trying to get more information to really understand your problem. But, instead of being grateful to people that are taking their own time to try and help you and responding as such, you respond in, let's just say, a less than helpful way. Quote Link to comment Share on other sites More sharing options...
daniel0816 Posted September 8, 2013 Author Share Posted September 8, 2013 Yea I never thought about it that way I apologize. The reason why I am saying I dont want to use union is because I had already tried it and the query worked great but it didnt output the data correctly into the HTML table. Each set of data wasnt lined up correctly and I dont know how to remove the empty table cells inorder to align the data up correctly in the table Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted September 8, 2013 Share Posted September 8, 2013 you have posted your series of questions on at least two php help sites, that i know of. you haven't gotten a solution yet because you have been throwing away the threads and starting new ones, rather than to stick with one thread and provide asked for, and needed information, that only you are aware of. i'm with Barand, bye, you have been repeatedly told the relationship between the tables is important, yet you specifically won't provide that information. for all we know, there's isn't anything that ties the data from one table to any other. you are just wasting your own and our time. Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 8, 2013 Share Posted September 8, 2013 Yea I never thought about it that way I apologize. The reason why I am saying I dont want to use union is because I had already tried it and the query worked great but it didnt output the data correctly into the HTML table. Each set of data wasnt lined up correctly and I dont know how to remove the empty table cells inorder to align the data up correctly in the table So, as already requested, give us some details. Show us some example data from the two tables and what you are trying to achieve. 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.