Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3937138
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:02:03+00:00 2026-05-20T00:02:03+00:00

To make thing easier to understand lets take the following example: I want to

  • 0

To make thing easier to understand lets take the following example:
I want to show only the top 5 comments for a specific post (Like the post on facebook where people cant comment them). How could I do this in SQL if you take this query

select tblPost.id,tblComment.id
from tblComment,tblPost
where tblPost.id = tblComment.postid

if I try select top 5 tblComment.id... it will return only 5 results and not all the post with only a maximum of 5 comment per post.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T00:02:04+00:00Added an answer on May 20, 2026 at 12:02 am
    select
       *
    FROM
       tblPost P
       OUTER APPLY
       (SELECT TOP 5 * FROM tblComment C  
          WHERE P.id = C.postid
          ORDER BY something) inline
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I basically want to make things easier by just looping LinkButtons instead of making
in order to make things easier for users i want to add multiple keyword
Just want to make sure one thing. In a windows machine (either a desktop
I want to make a website in cakephp framework.but the important thing is I
To make this easier to understand, I will present the exact same problem as
I have a wordpress theme that I like to duplicate. To make things easier
I'm trying to make the so called fine tune thing. Basically this looks like:
I'm trying to make an 'site layout' type thing where you click on an
I planned to make an iPhone app which store to-do lists like thing. What
I am trying to make a PIN entry activity, but one little thing is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.