mysql - How do I combine the results of two queries with ordering? -


How do you get included in the results of 2 questions according to the date?

  SELECT * from where 1 select the tag = '1' * 2 * tag from the table = '3'   

Table 1, Table 2 Has the same field in: id | Article | Author | Tag | Date:

PS: By the way, tags workid

You can use to get rows from both tables:

  SELECT id, article, author, tag, date1 to Table 1 WHERE tag = '1' Union Select All ID, Article, Author, Tag, Date 2 Table WHERE Tag = '3' Order Date   

You may also want to consider restructuring your database So that you can use only two tables instead of just one To distinguish each line type, a single table with a field can then query the query into:

  SELECT id, article, author, tag, datetable to WHERE (tag, Type) Order by IN (('1', 'type1'), ('3', 'type 2')) Date    

Comments