Monday, 15 June 2015

ambiguity - JOINT MySQL Query -


If I have tables like:

  table_1: 1, 'hello is my name 'Table: 2:', '2009: 11: 02 08:42' Table 1: 2, 'Hello My name is Dave', '2009: 11: 02 08:30' Table 2: 1, 2009: 11: 02 09:42 ' 

And think that all the table columns have the same col_names

Is there any way I have a different lines You can do a query to return results in the selection

with some of the lines:

  SELECT SELECT * table_1, table_2 ORDER BY dateReg DESC  

My return will look like this:

  1, 'Ima all because of Twitter #', '2009: 11: 02 09:42' 1, 'Hello my name is Hal,' 2009 : 11: 02 08:42 '2,' hello my name is Dave ',' 2009: 11: 02 08:30 ' 

When I try to run the above question, I have ambiguous errors (Obviously ... DUH ..: D) But there is a way that we can do this in PHP rather than using PHP code in PHP.

Any thoughts? Thank you in advance

You can use UNION (or UNION ALL) Can use ) to combine results from multiple queries: Select

  from SELECTEL1 table_1 UNION ALL SELECT * from Table_2  

(Simple UNION will remove duplicates; Unius All all return results.)


No comments:

Post a Comment