sql - limit and offset on joined table -


I have 2 tables category and items , let me show it Lift and offset by Categoy ID

Descending sequence with category table:

  a | B ----- + ----- 1 | Cat 1 2 | Cat 2 3 | Cat 3 4 | Cat 4 5 | Cat 5 6 | Cat6   

When this SQL code is run

  SELECT c *, F.Amount, f.Item FROM item_table f LEFT JOIN (SELECT * FROM range c LIMIT 'offset.', 3) ASCF CATIID = CID Order CID DED   

return me like this

  A | B Items ----- + ------------- 3 cat 3 | Items, items ... 2 | Cat 2 Items, items ... 1 | Cat 1 | Item, item ...   

but I should return it to me

  a | B Item ----- + ------------- 6 | Cat 6 Items, items ... 4 | Cat 4 Items, items ... 5 | Cat 5 | Item, item ...   

How can I do this?

Add order by section within subquery.

  SELECT c. *, F.Amount, f.Item item_table f LEFT JOIN (SELECT * FROM range by c ORDER c.id desc LIMIT). $ Offset ', 3) ASCF CATIID = CID Order ccid Ded    

Comments

Popular posts from this blog

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -