How to locate multiple mysql tables and arrange the content according to the last update time

Source: Internet
Author: User
How can I locate multiple mysql tables in which the content is sorted by the last update time mysql & nbsp; how can I locate multiple tables in which the content is sorted by the last update time and the fields are the same, only tables with different content names: aaa, bbb, ccc, ddd & nbsp; four table fields: title, classid, userid, newstime, how can I locate multiple tables in class mysql and arrange the content according to the last update time?
How can I locate multiple mysql tables and arrange the content according to the last update time?
The four fields are the same, and only the content is different.
Table name: aaa, bbb, ccc, and ddd

Table fields: title, classid, userid, newstime, classname, images


I want to check the descending order of the last update (newstime) of four independent tables without any association, and how to write the 10 records with userid = 2?
Unix timestamp format of newstime field
The userid field is the field of the user ID (that is, to find out the last updated content of this user in ten descending chronological order:
------ Solution --------------------


select a.* from aaa as a union all select b.* from bbb as b union all select c.* from ccc as c union all select d.* from ddd as d where userid = 2 orderby newstime desc limit 10


------ Solution --------------------
Upstairs.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.