Skip to content
Advertisement

Select specific number of sub items

I have this collection of data that I made a query on it

I want to make my query like this:

Query:

There are multiple brands and each brand has collection of hotels and each hotel must have only three comment not all comments that it has in db what is the type of condition that I should put it to get this data thank for your help

Advertisement

Answer

You can give a row number and then select the records having the row number upto 3.

Query

SQL Fiddle Here

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