Topic: Obtaining of a correct amount of lines of sampling at left join 1-to-many
Help please with such sampling.
I connect the table And (the list of the goods) the relation 1-1-many to the child table (parameters of the goods) through LEFT JOIN and naturally I receive in total sampling all records connected to A.Ogranichenie's LIMIT M table, N It would be applied to total sampling taking into account the table and the total of the found lines too with the registration to the table of Century As a result floats a page output and an incorrect amount of the found lines. How to make that restriction LIMIT M, N it would be applied only to the parent table And and the request about total number of the found lines SELECT FOUND_ROWS () would consider only the initial table And. In the conditions of sampling in WHERE columns as parent table and the child table of Century contain
Saw a similar question [url =] http://www.sql.ru/forum/606005/one-to-m ?????????? [/url] about the unique answer - . it turns out that other variants really are not present?:
select............... from (select * from table A as ta where...... LIMIT 5) as zz left join table B as tb on tb.id = zz.parent_id
It is necessary-whether in condition WHERE of the table tb to double a condition of fields of the table zz (I think that is not present)
Nested queries also will be fulfilled will be longer.
Into what select to interpose SQL_CALC_FOUND_ROWS to receive values only parent ?