nhuanhoangduc / cu8-sequelize-oracle

MIT License
26 stars 24 forks source link

limit not work correctly within include #10

Open diepmyduong opened 6 years ago

diepmyduong commented 6 years ago

When I using include option, the limit option will not work correctly.

Here is a query that generated within the include option:

SELECT * FROM (  
    SELECT t.*, ROWNUM ROWNUM_1 FROM (
        SELECT "District"."MAQU" "id", "District"."TENQUAN" "name", "province"."MATT" "province.id", "province"."TENTT" "province.name" 
        FROM "BTDQUAN" "District" 
            LEFT OUTER JOIN "BTDTT" "province"
                ON "District"."MATT" = "province"."MATT" 
    )t
)t2 
WHERE t2.ROWNUM_1 <=50;

as you can see the joined table will able to more than 50 row. if I have 25 district record, and each district have 10 ward record. Then joined table will have 250 record. But with the limit option, i just geted 5 district.