This article describes in detail how to sort combined queries in SQL statements. if you are interested, refer to the following.
SQL statement (several tables are combined for query to obtain the first to tenth data records ):
1. for example, tables A, B, C, and D are associated with tables A, B, C, and D respectively. for example:(A Inner join B By. id = B. AId) Inner join C By B. id = C. BId) Inner join D By C. id = D. CId Where condition 1 AND condition 2 ...;It is sorted by time. Obtain 11th to 20th data records. How should I write SQL statements?
Reply content:
1. for example, tables A, B, C, and D are associated with tables A, B, C, and D respectively. for example:(A Inner join B By. id = B. AId) Inner join C By B. id = C. BId) Inner join D By C. id = D. CId Where condition 1 AND condition 2 ...;It is sorted by time. Obtain 11th to 20th data records. How should I write SQL statements?
MySQL:
Select * from (select... from (A Inner join B By. id = B. AId) Inner join C By B. id = C. BId) Inner join D By C. id = D. CId Where condition 1 AND condition 2 ...) as table LIMIT 11,10
The above is the content of the SQL statement (several tables are jointly queried to obtain the nth to tenth pieces of data). For more information, see The PHP Chinese website (www.php1.cn )!