Skip to content
Advertisement

SQL N items per Group in SQL || SQL Sub Query Limit

I want to Select join with cats table with data. Join with cats.id = data.cat_id. with limit 3 data table row for each unique category id cat.id

Table: cats

Table:data

I want like bellow. For one cats per row select three data row select.

if this not posiable group_concat with , also work for me. I will split it with php.

Advertisement

Answer

Hope this solve your

here in the query … … ROW_COUNT <= 3 you may set limit for selection.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement