php - How do I display data from different tables with a single query? -


 **how display data below 1 query?** //limit 2 , order date , date2.  data tabel  |  1 | aaa    | 2014-06-16 16:29:51  data tabel b  |  1 | aa2    | 2014-06-16 16:29:52 table  +-------+--------+------+-----+---------+----------------+ | field | type   | null | key | default |          | +-------+--------+------+-----+---------+----------------+ | id    | int(3)      | no   | pri | null    | auto_increment | | name  | varchar(3)  | yes  |     | null    |                | | date  | datetime    | yes  |     | null    |                | +-------+-------------+------+-----+---------+----------------+  table b  +-------+--------+------+-----+---------+----------------+ | field | type   | null | key | default |          | +-------+--------+------+-----+---------+----------------+ | id    | int(3)     | no   | pri | null    | auto_increment | | name2 | varchar(3) | yes  |     | null    |                | | date2 | datetime   | yes  |     | null    |                | +-------+------------+------+-----+---------+----------------+  data table  +----+--------+ | id | name   | date +----+--------+ |  1 | aaa    | 2014-06-16 16:29:51 |  3 | aba    | 2014-06-16 16:29:52 |  8 | id     | 2014-06-16 16:29:53 | 10 | idr    | 2014-06-16 16:29:55   data table b  +----+--------+ | id | name2   | date2 +----+--------+ |  1 | aa2    | 2014-06-16 16:29:52 |  3 | a2a    | 2014-06-16 16:29:53 |  8 | id2    | 2014-06-16 16:29:53 | 10 | id2    | 2014-06-16 16:29:53  **how display data below 1 query?** //limit 2 , order date , date2.  data tabel  |  1 | aaa    | 2014-06-16 16:29:51  data tabel b  |  1 | aa2    | 2014-06-16 16:29:52 

from understood, want like:

(select id, name, date     tablea     limit 1)  union  (select id, name2, date2     tableb     limit 1) 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -