SQL statement (several tables are jointly queried together to obtain the first to tenth piece of data)

PHP中文网
Release: 2023-03-01 07:26:01
Original
2937 people have browsed it

SQL statement (several tables are jointly queried together to obtain the first to tenth piece of data):

1. For example, if there are four tables A, B, C, and D, A, B, C, D are related together such as: ((A Inner join B By A.Id =B.AId) Inner join C By B.Id =C.BId)Inner join D By C.Id =D.CId Where condition one AND condition Two... ; The above is sorted by time. Get the 11th to 20th data from it. How should the sql statement be written?

Reply content:

1. For example, if there are four tables A, B, C, and D respectively, A, B, C, and D are related together, such as: ((A Inner join B By A.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... ; The above is sorted by time. Get the 11th to 20th data from it. How should the sql statement be written?

MySQL:

select * from (select ... from ((A Inner join B By A.Id =B.AId) Inner join C By B.Id =C.BId)Inner join D By 
C.Id =D.CId Where 条件一 AND 条件二... ) as table LIMIT 11,10
Copy after login

The above is the content of the SQL statement (several tables are jointly queried together to obtain the first to tenth piece of data). For more related content, please pay attention to the PHP Chinese website (www.php.cn )!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!