mysql - SELECT n row FROM table1 PER table2 -



have 2 table: cats(category) , post.
want select n post per each category.

i have tried this:

select * cat right join (select * post post.catid=cat.id limit 3 ) ...  

the problem mysql not recognize cat.id inside sub query.

regards

select  a.id,          a.category,         b.description    category         inner join post b             on a.id = b.cat_id    (     select  count(*)        post c       b.cat_id = c.cat_id ,             b.id <= c.id ) <= 2 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -